(trunk libT) fix #2534: if port forwarding is disabled, tr_sessionClose() closes a random file descriptor
This commit is contained in:
parent
858e691381
commit
bcce43021f
|
@ -81,6 +81,7 @@ tr_natpmpInit( void )
|
|||
nat = tr_new0( struct tr_natpmp, 1 );
|
||||
nat->state = TR_NATPMP_DISCOVER;
|
||||
nat->port = -1;
|
||||
nat->natpmp.s = -1; /* socket */
|
||||
return nat;
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,8 @@ tr_natpmpClose( tr_natpmp * nat )
|
|||
{
|
||||
if( nat )
|
||||
{
|
||||
closenatpmp( &nat->natpmp );
|
||||
if( nat->natpmp.s >= 0 )
|
||||
tr_netCloseSocket( nat->natpmp.s );
|
||||
tr_free( nat );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue