[ENet-discuss] possible enet bug
Bjørn Lindeijer
bjorn at lindeijer.nl
Wed Jul 23 06:46:51 PDT 2008
On 7/23/08, eye at dihalt.com <eye at dihalt.com> wrote:
> Hello
>
> I just found that no ENET_EVENT_TYPE_DISCONNECT will be
> returned by enet_host_process() if enet_peer_disconnect()
> is called while peer is not yet connected ( in process of
> connection )
>
> the problem line: peer.c:446
> suggested fix: peer.c:446
>
> if (peer -> state == ENET_PEER_STATE_CONNECTED || peer
> -> state == ENET_PEER_STATE_DISCONNECT_LATER)
> peer -> state = ENET_PEER_STATE_DISCONNECTING;
> else
> {
> enet_host_flush (peer -> host);
> - enet_peer_reset (peer);
> + peer->state = ENET_PEER_STATE_ZOMBIE;
> }
>
> Is this correct?
I would say you should never get a DISCONNECT event when there hasn't
been a CONNECTED event yet. At least we're creating wrapper classes
around peers on connect that have to be cleaned up on disconnect. It
would be rather confusing to get disconnect events for peers that
haven't even connected yet.
Regards,
Bjørn
More information about the ENet-discuss
mailing list