diff --git a/libtransmission/peer-common.h b/libtransmission/peer-common.h index ffa6e0333..566c12877 100644 --- a/libtransmission/peer-common.h +++ b/libtransmission/peer-common.h @@ -112,8 +112,6 @@ typedef struct tr_peer /* number of bad pieces they've contributed to */ uint8_t strikes; - uint8_t encryption_preference; - /* how many requests the peer has made that we haven't responded to yet */ int pendingReqsToClient; @@ -121,6 +119,8 @@ typedef struct tr_peer int pendingReqsToPeer; struct tr_peerIo * io; + + /* Hook to private peer-mgr information */ struct peer_atom * atom; /** how complete the peer's copy of the torrent is. [0.0...1.0] */ diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index 12a3039e2..85aa67ab7 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -69,13 +69,6 @@ tr_pex; struct tr_peerIo; struct tr_peermsgs; -enum -{ - ENCRYPTION_PREFERENCE_UNKNOWN, - ENCRYPTION_PREFERENCE_YES, - ENCRYPTION_PREFERENCE_NO -}; - /* opaque forward declaration */ struct peer_atom; diff --git a/libtransmission/peer-msgs.c b/libtransmission/peer-msgs.c index 7e61defb1..13aa78fe4 100644 --- a/libtransmission/peer-msgs.c +++ b/libtransmission/peer-msgs.c @@ -104,6 +104,16 @@ enum AWAITING_BT_PIECE }; +typedef enum +{ + ENCRYPTION_PREFERENCE_UNKNOWN, + ENCRYPTION_PREFERENCE_YES, + ENCRYPTION_PREFERENCE_NO +} +encryption_preference_t; + + + /** *** **/ @@ -179,7 +189,9 @@ struct tr_peermsgs tr_port dht_port; - size_t metadata_size_hint; + encryption_preference_t encryption_preference; + + size_t metadata_size_hint; #if 0 size_t fastsetSize; tr_piece_index_t fastset[MAX_FAST_SET_SIZE]; @@ -883,8 +895,8 @@ parseLtepHandshake (tr_peermsgs * msgs, int len, struct evbuffer * inbuf) /* does the peer prefer encrypted connections? */ if (tr_variantDictFindInt (&val, TR_KEY_e, &i)) { - msgs->peer->encryption_preference = i ? ENCRYPTION_PREFERENCE_YES - : ENCRYPTION_PREFERENCE_NO; + msgs->encryption_preference = i ? ENCRYPTION_PREFERENCE_YES + : ENCRYPTION_PREFERENCE_NO; if (i) pex.flags |= ADDED_F_ENCRYPTION_FLAG; }