kevincdurand1 / quadra

Automatically exported from code.google.com/p/quadra
0 stars 0 forks source link

Quadra crashed in single player mode when no network is available #89

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Quadra crashes (segfault) when using single player mode in offline mode (all
network interfaces down)

I have traced the problem, it is in the method Game::prepare_logging() in the
following rows:
        Dword addr=net->host_adr_pub[0];
        char st[65];
        Net::stringaddress(st, addr, config.info.port_number);
        log.add(Packet_serverlog::Var("server_address", st));

It looks like the "addr" is faulty, any attempt to access it will cause a
segmentation fault. It also happens when attempting to display its value
using msgbox() or printf().

If I replace the addr assignation with the following, it works fine:
Dword addr = 0

Commenting out Net::stringaddress ... also solves the issue.

This problem occurs in trunk and quadra-sdl.

I also wonder why quadra needs/checks for network access in single player
mode. I think it would be better to instantiate the network classes only
when explicitly selecting multiplayer->network mode.

Original issue reported on code.google.com by PVinc...@googlemail.com on 24 Aug 2008 at 1:04

GoogleCodeExporter commented 8 years ago

Original comment by pphaneuf on 11 Oct 2008 at 2:44

GoogleCodeExporter commented 8 years ago
Should be fixed with r628 (in trunk, I'll merge to quadra-sdl momentarily). I
couldn't reproduce the problem in a "natural" way (Mac OS X keeps a close watch 
on
its interfaces, and brings the loopback interface up the moment you bring it 
down, as
it knows Quadra crashing is a sad event!). I'm a bit curious as to how this 
happened,
as from a quick look at the code, it looks like it should always have something 
in
that array, but now it should be bulletproof.

I agree that, ideally, networking should be involved only when needed, but 
Quadra's
source code is subtle and quick to anger, so I think it's better not to mess 
with
this at this point. ;-)

Original comment by pphaneuf on 18 Oct 2008 at 5:47