Changeset 13932
- Timestamp:
- Feb 2, 2013, 5:31:43 AM (8 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/handshake.c
r13868 r13932 195 195 const uint8_t * torrentHash = tr_cryptoGetTorrentHash (handshake->crypto); 196 196 const tr_torrent * tor = tr_torrentFindFromHash (handshake->session, torrentHash); 197 const uint8_t * peer_id = tor && *tor->peer_id ? tor->peer_id : tr_getPeerId (handshake->session);197 const uint8_t * peer_id = tor->peer_id; 198 198 199 199 memcpy (walk, HANDSHAKE_NAME, HANDSHAKE_NAME_LEN); … … 273 273 274 274 tor = tr_torrentFindFromHash (handshake->session, hash); 275 tor_peer_id = tor ? tor->peer_id : tr_getPeerId (handshake->session);275 tor_peer_id = tor->peer_id; 276 276 if (!memcmp (peer_id, tor_peer_id, PEER_ID_LEN)) 277 277 { … … 686 686 struct evbuffer * inbuf) 687 687 { 688 bool peerIsGood;688 bool connected_to_self; 689 689 char client[128]; 690 uint8_t peer_id[PEER_ID_LEN]; 690 691 tr_torrent * tor; 691 const uint8_t * tor_peer_id;692 uint8_t peer_id[PEER_ID_LEN];693 692 694 693 if (evbuffer_get_length (inbuf) < PEER_ID_LEN) … … 705 704 /* if we've somehow connected to ourselves, don't keep the connection */ 706 705 tor = tr_torrentFindFromHash (handshake->session, tr_peerIoGetTorrentHash (handshake->io)); 707 tor_peer_id = tor ? tor->peer_id : tr_getPeerId (handshake->session); 708 peerIsGood = memcmp (peer_id, tor_peer_id, PEER_ID_LEN) != 0; 709 dbgmsg (handshake, "isPeerGood == %d", (int)peerIsGood); 710 return tr_handshakeDone (handshake, peerIsGood); 706 connected_to_self = (tor != NULL) && !memcmp (peer_id, tor->peer_id, PEER_ID_LEN); 707 708 return tr_handshakeDone (handshake, !connected_to_self); 711 709 } 712 710 -
trunk/libtransmission/session.c
r13868 r13932 593 593 session->magicNumber = SESSION_MAGIC_NUMBER; 594 594 tr_bandwidthConstruct (&session->bandwidth, session, NULL); 595 tr_peerIdInit (session->peer_id);596 595 tr_variantInitList (&session->removedTorrents, 0); 597 596 -
trunk/libtransmission/session.h
r13711 r13932 224 224 struct tr_bindinfo * public_ipv4; 225 225 struct tr_bindinfo * public_ipv6; 226 227 uint8_t peer_id[PEER_ID_LEN+1];228 226 }; 229 227 … … 232 230 { 233 231 return session->public_peer_port; 234 }235 236 static inline const uint8_t*237 tr_getPeerId (tr_session * session)238 {239 return session->peer_id;240 232 } 241 233
Note: See TracChangeset
for help on using the changeset viewer.