[ENet-discuss] Connecting to self (resolved)

Krasimir Marinov krasi at jklsemi.com
Mon Nov 18 05:15:43 PST 2013


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. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20131118/abff6fff/attachment.html>


More information about the ENet-discuss mailing list