1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-05 22:12:11 +00:00

a little code simplification -- remove unnecessary branches

This commit is contained in:
Charles Kerr 2007-10-04 20:49:37 +00:00
parent 0872b4f40a
commit 80979e0240

View file

@ -324,35 +324,20 @@ getPeer( Torrent * torrent, const struct in_addr * in_addr )
return peer;
}
static void
disconnectPeer( tr_peer * peer )
{
assert( peer != NULL );
tr_peerIoFree( peer->io );
peer->io = NULL;
if( peer->msgs != NULL )
{
tr_peerMsgsUnsubscribe( peer->msgs, peer->msgsTag );
tr_peerMsgsFree( peer->msgs );
peer->msgs = NULL;
}
tr_bitfieldFree( peer->have );
peer->have = NULL;
tr_bitfieldFree( peer->blame );
peer->blame = NULL;
tr_bitfieldFree( peer->banned );
peer->banned = NULL;
}
static void
peerDestructor( tr_peer * peer )
{
disconnectPeer( peer );
assert( peer != NULL );
assert( peer->msgs != NULL );
tr_peerMsgsUnsubscribe( peer->msgs, peer->msgsTag );
tr_peerMsgsFree( peer->msgs );
tr_peerIoFree( peer->io );
tr_bitfieldFree( peer->have );
tr_bitfieldFree( peer->blame );
tr_bitfieldFree( peer->banned );
tr_rcClose( peer->rateToClient );
tr_rcClose( peer->rateToPeer );
tr_free( peer->client );