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 */
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] */

View File

@ -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;

View File

@ -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;
}