Changeset 2954 for branches/encryption/libtransmission/peer-io.c
- Timestamp:
- Aug 31, 2007, 8:43:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/encryption/libtransmission/peer-io.c
r2953 r2954 31 31 { 32 32 struct tr_handle * handle; 33 struct tr_torrent * torrent;34 33 35 34 struct in_addr in_addr; … … 98 97 tr_peerIoNew( struct tr_handle * handle, 99 98 struct in_addr * in_addr, 100 struct tr_torrent * torrent,99 const uint8_t * torrentHash, 101 100 int isIncoming, 102 101 int socket ) … … 104 103 tr_peerIo * c; 105 104 c = tr_new0( tr_peerIo, 1 ); 106 c->torrent = torrent; 107 c->crypto = tr_cryptoNew( torrent ? torrent->info.hash : NULL, isIncoming ); 105 c->crypto = tr_cryptoNew( torrentHash, isIncoming ); 108 106 c->handle = handle; 109 107 c->in_addr = *in_addr; … … 132 130 struct in_addr * in_addr, 133 131 int port, 134 struct tr_torrent * torrent)132 const uint8_t * torrentHash ) 135 133 { 136 134 tr_peerIo * c; … … 139 137 assert( in_addr != NULL ); 140 138 assert( port >= 0 ); 141 assert( torrent != NULL );142 143 c = tr_peerIoNew( handle, in_addr, torrent , 0,139 assert( torrentHash != NULL ); 140 141 c = tr_peerIoNew( handle, in_addr, torrentHash, 0, 144 142 tr_netOpenTCP( in_addr, port, 0 ) ); 145 143 c->port = port; … … 163 161 164 162 return io->handle; 163 } 164 165 const struct in_addr* 166 tr_peerIoGetAddress( const tr_peerIo * io, uint16_t * port ) 167 { 168 assert( io != NULL ); 169 170 if( port != NULL ) 171 *port = io->port; 172 173 return &io->in_addr; 165 174 } 166 175 … … 221 230 222 231 void 223 tr_peerIoSetTorrent( tr_peerIo * io, 224 struct tr_torrent * torrent ) 225 { 226 io->torrent = torrent; 227 228 tr_cryptoSetTorrentHash( io->crypto, torrent->info.hash ); 229 } 230 231 struct tr_torrent* 232 tr_peerIoSetTorrentHash( tr_peerIo * io, 233 const uint8_t * hash ) 234 { 235 tr_cryptoSetTorrentHash( io->crypto, hash ); 236 } 237 238 const uint8_t* 232 239 tr_peerIoGetTorrent( tr_peerIo * io ) 233 240 { 234 return io->torrent;235 } 236 237 /** 238 *** 239 **/ 240 241 void 242 tr_peerIoSetPeersId( tr_peerIo * io,243 const uint8_t* peer_id )241 return tr_cryptoGetTorrentHash( io->crypto ); 242 } 243 244 /** 245 *** 246 **/ 247 248 void 249 tr_peerIoSetPeersId( tr_peerIo * io, 250 const uint8_t * peer_id ) 244 251 { 245 252 assert( io != NULL ); … … 265 272 266 273 void 267 tr_peerIoSetExtension( tr_peerIo * io,268 intextensions )274 tr_peerIoSetExtension( tr_peerIo * io, 275 int extensions ) 269 276 { 270 277 assert( io != NULL );
Note: See TracChangeset
for help on using the changeset viewer.