<div dir="ltr">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.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 18, 2013 at 3:15 PM, Krasimir Marinov <span dir="ltr"><<a href="mailto:krasi@jklsemi.com" target="_blank">krasi@jklsemi.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Lee,<br>I've a comment/question on the committed change:<br><br>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).<div>

<br></div><div>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"</div><div>check in the inner if, after the check for same host (see below).</div>

<div><br>-        if (currentPeer -> address.host == host -> receivedAddress.host)<br>+        if (currentPeer -> state != ENET_PEER_STATE_CONNECTING /* Krasi: see my comment below */ &&<br>+            currentPeer -> address.host == host -> receivedAddress.host)<br>

         {</div><div><br></div><div>             /* Krasi: I think the check should be here instead of the above if() in order to correctly update duplicatePeers? */<div class="im"><br>             if (currentPeer -> address.port == host -> receivedAddress.port &&<br>
</div><div class="im">
                 currentPeer -> connectID == command -> connect.connectID)<br>              return NULL;<br><br></div>            ++ duplicatePeers;<br>        }<br>    }<br><br>    if (peer == NULL || duplicatePeers >= host -> duplicatePeers)<br>

      return NULL;<br><br>I might well be wrong or don't understand the purpose of duplicatePeers, so sorry for the comment :).</div><div><br></div><div>--Krasi</div><div class="im"><div><br>On Mon, Nov 18, 2013 at 2:21 PM, Lee Salzman <<a href="mailto:lsalzman@gmail.com" target="_blank">lsalzman@gmail.com</a>> wrote:<br>

><br>> 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. ;)<br></div></div></div>
<br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br></div>