Changeset 3129
- Timestamp:
- Sep 22, 2007, 12:53:11 AM (15 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/handshake.c
r3128 r3129 257 257 } 258 258 259 static void 260 tr_handshakeDone( tr_handshake * handshake, int isConnected ); 261 259 262 /*** 260 263 **** … … 291 294 /* cleanup */ 292 295 evbuffer_free( outbuf ); 296 } 297 298 static uint32_t 299 getCryptoProvide( const tr_handshake * handshake ) 300 { 301 uint32_t i = 0; 302 303 i |= CRYPTO_PROVIDE_CRYPTO; /* always allow crypto */ 304 305 if( handshake->allowUnencryptedPeers ) /* sometimes allow plaintext */ 306 i |= CRYPTO_PROVIDE_PLAINTEXT; 307 308 return i; 293 309 } 294 310 … … 365 381 366 382 /* crypto_provide */ 367 crypto_provide = 0; 368 crypto_provide |= CRYPTO_PROVIDE_CRYPTO; /* always allow crypto */ 369 if( handshake->allowUnencryptedPeers ) /* sometimes allow plaintext */ 370 crypto_provide |= CRYPTO_PROVIDE_PLAINTEXT; 371 fprintf( stderr, "crypto_provide is %d\n", (int)crypto_provide ); 372 383 crypto_provide = getCryptoProvide( handshake ); 373 384 crypto_provide = htonl( crypto_provide ); 374 385 tr_cryptoEncrypt( handshake->crypto, sizeof(crypto_provide), &crypto_provide, &crypto_provide ); … … 457 468 458 469 tr_peerIoReadUint32( handshake->io, inbuf, &crypto_select ); 459 assert( crypto_select==1 || crypto_select==2 );460 470 handshake->crypto_select = crypto_select; 461 471 dbgmsg( handshake, "crypto select is %d", (int)crypto_select ); 472 if( ! ( crypto_select & getCryptoProvide( handshake ) ) ) 473 { 474 dbgmsg( handshake, "peer selected an encryption option we didn't provide" ); 475 tr_handshakeDone( handshake, FALSE ); 476 return READ_DONE; 477 } 462 478 463 479 tr_peerIoReadUint16( handshake->io, inbuf, &pad_d_len ); … … 496 512 **** 497 513 ***/ 498 499 static void500 tr_handshakeDone( tr_handshake * handshake, int isConnected );501 514 502 515 static int -
trunk/libtransmission/peer-mgr.c
r3127 r3129 224 224 memcpy( hash, t->hash, SHA_DIGEST_LENGTH ); 225 225 226 tr_timerFree( &t->reconnectTimer ); 227 tr_timerFree( &t->reconnectSoonTimer ); 226 228 tr_timerFree( &t->rechokeTimer ); 227 229 tr_timerFree( &t->rechokeSoonTimer ); … … 1162 1164 1163 1165 static int 1164 reconnectPulse( void * vt )1165 { 1166 static int n = 0; 1166 reconnectPulse( void * vt UNUSED ) 1167 { 1168 #if 0 1167 1169 Torrent * t = vt; 1168 fprintf( stderr, "when this code is written, it will cull out crappy peer connections and initiate new ones within some limit. %p - %d\n", t, ++n ); 1170 /* FIXME */ 1171 #endif 1169 1172 return TRUE; 1170 1173 }
Note: See TracChangeset
for help on using the changeset viewer.