Try printing the pointer values as you assign/new (on connect) and free/delete (on disconnect). Then print pointer where you access your local 'peer' pointers. You'll probably find that you access a peer after it has been deleted or such, my guess.
Ruud On Thu, Apr 28, 2011 at 4:44 AM, Jacob F. <[email protected]> wrote: > How it is now if it's an error event.type() will return 'none' however I > have tested it and no errors are being created (as far as I can tell.) I > updated the code a little, still nothing good. > I did find one more thing though. The client is printing that it connected > 1 client-service before the server prints that a client connected, and only > on the next client-service it connects on the server, and then the next > server-service segfaults. > > Does enet do anything at all with peer->data? > > Here is the whole server/client code (wrapped in Python, but it segfaults > when using C++ also.) > I know it would be easier to debug if I remade everything step by step from > scratch, though I'm afraid I would arrive at the same place without a > visible explanation. I will do that if we cannot figure this out. > > Server: > from scge import * > from time import * > > serv = server() #defaults to localhost:2000 > > while True: > e = serv.service() > if e.type() == 'disconnect': > print('Someone disconnected.') > elif e.type() == 'connect': > print('Someone connected.') > elif e.type() == 'receive': > print('received') > sleep(.2) > > Client: > from scge import * from time import * cli = client() cli.connect() > window(160, 120) while window_opened(): e = cli.service() if e.type() == > 'connect': print('Connected.') swap() sleep(.01) > > On Wed, Apr 27, 2011 at 4:45 PM, Jay Sprenkle <[email protected]> wrote: > >> If enet returns an error you don't change e.evt.peer->data and you don't >> return an error code. >> The code that calls this method has no way to detect if this happens. >> It will blindly use that value when it may not be correct. >> >> >> On Wed, Apr 27, 2011 at 3:34 PM, Jacob F. <[email protected]> wrote: >> >>> Both the server and client are created without an error, and I can >>> receive the data placed into e.evt.peer->data after I set it. Are there any >>> specific errors that I should check for? >>> >>> >> _______________________________________________ >> ENet-discuss mailing list >> [email protected] >> http://lists.cubik.org/mailman/listinfo/enet-discuss >> >> > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > >
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
