[ENet-discuss] ENetPeer->data and enet_host_service

Jacob F. queatz at gmail.com
Wed Apr 27 13:34:52 PDT 2011


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?
By the way, the segfault happens directly on that call to enet_host_service.
 I really don't know how that and the peer data relate but somehow they do.
 The segfault happens even if I don't use the peer data or call it anywhere,
only having that one line to set it to something other than NULL.  Setting
it to NULL does not make the segmentation fault happen.

On Wed, Apr 27, 2011 at 3:36 PM, Jay Sprenkle <jsprenkle at gmail.com> wrote:

> Perhaps you should clear e.evt.peer->data in the case of an error?
> There's no way any caller could determine if the value there is valid/an
> error occurred.
>
>
> On Wed, Apr 27, 2011 at 2:20 PM, Jacob F. <queatz at gmail.com> wrote:
>
>> I really need some help.  This bug has stalled me for 2 days and I am
>> getting no where at all.
>> What happens is when I change a peer's void* I can no longer call
>> enet_host_service() without making a segmentation fault.
>>
>> I have pushed the bugged code to my repository so you can look at it.
>>
>>
>> https://github.com/Queatz/Simple-C---Game-Engine/blob/master/engine/network.cpp
>>
>> As you can see, at line 147 I assign something to the peer data if someone
>> connects.  Now, just above that on line 138 you see the call to
>> enet_host_service where the segmentation fault happens.  It
>> happens consistently on the next call (which is of a none event type) after
>> a client connects, causing that peer data to get set.  With that line (147)
>> commented I get no segmentation fault at all.
>>
>> If someone could see something I am missing I would be very grateful.
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>
>
>
> --
> ---
> "The great thing about Object Oriented code is that it can make small,
> simple problems look like large, complex ones."
>
> _______________________________________________
> 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/20110427/7b4598f6/attachment.html>


More information about the ENet-discuss mailing list