[ENet-discuss] gracefully exiting

Benoit Germain bgermain at ubisoft.fr
Sat Oct 2 08:11:50 PDT 2010


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;
    }

That's all.


De : enet-discuss-bounces at cubik.org [mailto:enet-discuss-bounces at cubik.org] De la part de Jay Sprenkle
Envoyé : samedi 2 octobre 2010 16:45
À : Discussion of the ENet library
Objet : Re: [ENet-discuss] gracefully exiting

Thanks. I hadn't gotten the new version.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20101002/8133bf88/attachment-0001.html>


More information about the ENet-discuss mailing list