[ENet-discuss] ENetPeer->data and enet_host_service

Jacob F. queatz at gmail.com
Thu Apr 28 09:50:07 PDT 2011


It segfaults whether or not I access the data at all.

I made a simple example off the enet tutorial, you should be able to compile
it (the binaries are 64-bit Linux.)

http://queatz.com/enetest.zip

Run the server then run the client and see if it segfaults.  Now I'm
thinking there is a bug, but how to describe it??

On Thu, Apr 28, 2011 at 4:36 AM, Ruud van Gaal <ruud at racer.nl> wrote:

> 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. <queatz at gmail.com> 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 <jsprenkle at gmail.com>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. <queatz at gmail.com> 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
>>> ENet-discuss at cubik.org
>>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>>
>>>
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20110428/970343c6/attachment.html>


More information about the ENet-discuss mailing list