1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 17:47:37 +00:00

(trunk libT) probably fix r7618 reported in #transmission by Rolcol

This commit is contained in:
Charles Kerr 2009-01-05 06:45:08 +00:00
parent 5ccd5a7700
commit 124658791a
2 changed files with 8 additions and 2 deletions

View file

@ -1095,7 +1095,7 @@ void
tr_handshakeFree( tr_handshake * handshake ) tr_handshakeFree( tr_handshake * handshake )
{ {
if( handshake->io ) if( handshake->io )
tr_peerIoUnref( handshake->io ); tr_peerIoUnref( handshake->io ); /* balanced by the ref in tr_handshakeNew */
tr_free( handshake ); tr_free( handshake );
} }
@ -1172,6 +1172,7 @@ tr_handshakeNew( tr_peerIo * io,
handshake->doneUserData = doneUserData; handshake->doneUserData = doneUserData;
handshake->session = tr_peerIoGetSession( io ); handshake->session = tr_peerIoGetSession( io );
tr_peerIoRef( io ); /* balanced by the unref in tr_handshakeFree */
tr_peerIoSetIOFuncs( handshake->io, canRead, NULL, gotError, handshake ); tr_peerIoSetIOFuncs( handshake->io, canRead, NULL, gotError, handshake );
if( tr_peerIoIsIncoming( handshake->io ) ) if( tr_peerIoIsIncoming( handshake->io ) )

View file

@ -355,7 +355,7 @@ peerDestructor( tr_peer * peer )
tr_peerMsgsFree( peer->msgs ); tr_peerMsgsFree( peer->msgs );
} }
tr_peerIoUnref( peer->io ); tr_peerIoUnref( peer->io ); /* balanced by the ref in handshakeDoneCB() */
tr_bitfieldFree( peer->have ); tr_bitfieldFree( peer->have );
tr_bitfieldFree( peer->blame ); tr_bitfieldFree( peer->blame );
@ -1258,6 +1258,7 @@ myHandshakeDoneCB( tr_handshake * handshake,
peer->port = port; peer->port = port;
peer->io = tr_handshakeStealIO( handshake ); peer->io = tr_handshakeStealIO( handshake );
tr_peerIoRef( peer->io ); /* balanced by the unref in peerDestructor() */
tr_peerIoSetParent( peer->io, t->tor->bandwidth ); tr_peerIoSetParent( peer->io, t->tor->bandwidth );
tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t, &peer->msgsTag ); tr_peerMsgsNew( t->tor, peer, peerCallbackFunc, t, &peer->msgsTag );
@ -1304,6 +1305,8 @@ tr_peerMgrAddIncoming( tr_peerMgr * manager,
myHandshakeDoneCB, myHandshakeDoneCB,
manager ); manager );
tr_peerIoUnref( io ); /* balanced by the implicit ref in tr_peerIoNewIncoming() */
tr_ptrArrayInsertSorted( &manager->incomingHandshakes, handshake, tr_ptrArrayInsertSorted( &manager->incomingHandshakes, handshake,
handshakeCompare ); handshakeCompare );
} }
@ -2325,6 +2328,8 @@ tordbg( t, "nCandidates is %d, MAX_RECONNECTIONS_PER_PULSE is %d, getPeerCount(t
assert( tr_peerIoGetTorrentHash( io ) ); assert( tr_peerIoGetTorrentHash( io ) );
tr_peerIoUnref( io ); /* balanced by the implicit ref in tr_peerIoNewOutgoing() */
++newConnectionsThisSecond; ++newConnectionsThisSecond;
tr_ptrArrayInsertSorted( &t->outgoingHandshakes, handshake, tr_ptrArrayInsertSorted( &t->outgoingHandshakes, handshake,