[ENet-discuss] gracefully exiting
Jay Sprenkle
jsprenkle at gmail.com
Sat Oct 2 08:20:34 PDT 2010
Excellent. Thanks for sharing your solution :)
On Sat, Oct 2, 2010 at 10:11 AM, Benoit Germain <bgermain at ubisoft.fr> wrote:
> Enet 1.3 won’t filter on the incoming connect reason out of the box, you
> have to change the code. Changes are as follows:
>
>
>
> Enet.h: Add in structure _ENetHost:
>
> enet_uint32 sessionPassword;
>
>
>
> host.c: Add initialization in enet_host_create();
>
> host -> sessionPassword = 0;
>
>
>
> protocol.c: add password filtering at the beginning of
> enet_protocol_handle_connect:
>
>
>
> switch (host -> sessionPassword)
>
> {
>
> case 0: // session is opened, proceed
>
> break;
>
>
>
> case 0xffffffff: // session is locked, ignore all requests
>
> return NULL;
>
>
>
> default: // session is password-protected, proceed only if incoming
> request data matches password
>
> if (ENET_NET_TO_HOST_32 (command -> connect.data) != host ->
> sessionPassword)
>
> return NULL;
>
> }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20101002/06135e1d/attachment.html>
More information about the ENet-discuss
mailing list