]> granicus.if.org Git - transmission/commitdiff
Propagate uTP and ut_holepunch information over PEX.
authorJuliusz Chroboczek <jch@pps.univ-paris-diderot.fr>
Fri, 18 Feb 2011 00:24:48 +0000 (00:24 +0000)
committerJuliusz Chroboczek <jch@pps.univ-paris-diderot.fr>
Fri, 18 Feb 2011 00:24:48 +0000 (00:24 +0000)
libtransmission/peer-mgr.c
libtransmission/peer-msgs.c

index 8394dd2052296876883280d4691a0caf1682a141..5051e07a76005dc8a9563a0f1ed52bdda05b3a7a 100644 (file)
@@ -1958,6 +1958,11 @@ myHandshakeDoneCB( tr_handshake  * handshake,
             atom->flags2 &= ~MYFLAG_UNREACHABLE;
         }
 
+        /* In principle, this flag specifies whether the peer groks uTP,
+           not whether it's currently connected over uTP. */
+        if( io->utp_socket )
+            atom->flags |= ADDED_F_UTP_FLAGS;
+
         if( atom->flags2 & MYFLAG_BANNED )
         {
             tordbg( t, "banned peer %s tried to reconnect",
index 826682bc4c8ba4fc0e7023bb747bdc305a65962f..73cbb90125abd9444534893d89848c6816a831c5 100644 (file)
@@ -939,6 +939,12 @@ parseLtepHandshake( tr_peermsgs *     msgs,
             msgs->ut_metadata_id = (uint8_t) i;
             dbgmsg( msgs, "msgs->ut_metadata_id is %d", (int)msgs->ut_metadata_id );
         }
+        /* We don't support ut_holepunch yet, but we might as well
+           propagate this information over PEX. */
+        if( tr_bencDictFindInt( sub, "ut_holepunch", &i ) ) {
+            if( i != 0 )
+                pex.flags |= ADDED_F_HOLEPUNCH;
+        }
     }
 
     /* look for metainfo size (BEP 9) */