[ENet-discuss] Connecting to self (resolved)

Lee Salzman lsalzman at gmail.com
Mon Nov 18 05:24:55 PST 2013


The duplicates check is meant to guard against a foreign host trying to
make a lot of redundant connections. It is not meant to guard against your
connection attempts on your side, hence, as far as I can see, it should be
where I put it, not where you put it.


On Mon, Nov 18, 2013 at 3:15 PM, Krasimir Marinov <krasi at jklsemi.com> wrote:

> Lee,
> I've a comment/question on the committed change:
>
> As I understand the code, we want the duplicatePeers variable to be
> updated each time we have connect confirmation from the same host (although
> I don't understand its purpose yet).
>
> I think it won't be updated the way it's now, that's why I've put the
> "currentPeer -> state != ENET_PEER_STATE_CONNECTING"
> check in the inner if, after the check for same host (see below).
>
> -        if (currentPeer -> address.host == host -> receivedAddress.host)
> +        if (currentPeer -> state != ENET_PEER_STATE_CONNECTING /* Krasi:
> see my comment below */ &&
> +            currentPeer -> address.host == host -> receivedAddress.host)
>          {
>
>              /* Krasi: I think the check should be here instead of the
> above if() in order to correctly update duplicatePeers? */
>
>              if (currentPeer -> address.port == host ->
> receivedAddress.port &&
>                  currentPeer -> connectID == command -> connect.connectID)
>               return NULL;
>
>             ++ duplicatePeers;
>         }
>     }
>
>     if (peer == NULL || duplicatePeers >= host -> duplicatePeers)
>       return NULL;
>
> I might well be wrong or don't understand the purpose of duplicatePeers,
> so sorry for the comment :).
>
> --Krasi
>
> On Mon, Nov 18, 2013 at 2:21 PM, Lee Salzman <lsalzman at gmail.com> wrote:
> >
> > For better or worse I committed a version of this fix to the repo. I
> didn't have time to actually test it out, though, so I will, uh, let you
> guys beta-test this one. ;)
>
> _______________________________________________
> 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/20131118/c515481e/attachment.html>


More information about the ENet-discuss mailing list