1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-25 07:22:38 +00:00

move tr_peer.encryptionPreference to tr_peermsgs.encryptionPreference

This commit is contained in:
Jordan Lee 2013-02-03 22:45:32 +00:00
parent 3cb7595b85
commit f370a76c57
3 changed files with 17 additions and 12 deletions

View file

@ -112,8 +112,6 @@ typedef struct tr_peer
/* number of bad pieces they've contributed to */ /* number of bad pieces they've contributed to */
uint8_t strikes; uint8_t strikes;
uint8_t encryption_preference;
/* how many requests the peer has made that we haven't responded to yet */ /* how many requests the peer has made that we haven't responded to yet */
int pendingReqsToClient; int pendingReqsToClient;
@ -121,6 +119,8 @@ typedef struct tr_peer
int pendingReqsToPeer; int pendingReqsToPeer;
struct tr_peerIo * io; struct tr_peerIo * io;
/* Hook to private peer-mgr information */
struct peer_atom * atom; struct peer_atom * atom;
/** how complete the peer's copy of the torrent is. [0.0...1.0] */ /** how complete the peer's copy of the torrent is. [0.0...1.0] */

View file

@ -69,13 +69,6 @@ tr_pex;
struct tr_peerIo; struct tr_peerIo;
struct tr_peermsgs; struct tr_peermsgs;
enum
{
ENCRYPTION_PREFERENCE_UNKNOWN,
ENCRYPTION_PREFERENCE_YES,
ENCRYPTION_PREFERENCE_NO
};
/* opaque forward declaration */ /* opaque forward declaration */
struct peer_atom; struct peer_atom;

View file

@ -104,6 +104,16 @@ enum
AWAITING_BT_PIECE 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; tr_port dht_port;
size_t metadata_size_hint; encryption_preference_t encryption_preference;
size_t metadata_size_hint;
#if 0 #if 0
size_t fastsetSize; size_t fastsetSize;
tr_piece_index_t fastset[MAX_FAST_SET_SIZE]; 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? */ /* does the peer prefer encrypted connections? */
if (tr_variantDictFindInt (&val, TR_KEY_e, &i)) { if (tr_variantDictFindInt (&val, TR_KEY_e, &i)) {
msgs->peer->encryption_preference = i ? ENCRYPTION_PREFERENCE_YES msgs->encryption_preference = i ? ENCRYPTION_PREFERENCE_YES
: ENCRYPTION_PREFERENCE_NO; : ENCRYPTION_PREFERENCE_NO;
if (i) if (i)
pex.flags |= ADDED_F_ENCRYPTION_FLAG; pex.flags |= ADDED_F_ENCRYPTION_FLAG;
} }