mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
#846: transmissioncli attempts to bind to port even when not needed
This commit is contained in:
@@ -139,6 +139,11 @@ main( int argc, char ** argv )
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* don't bind the port if we're just running the CLI
|
||||
* to get metainfo or to create a torrent */
|
||||
if( showInfo || ( sourceFile != NULL ) )
|
||||
bindPort = -1;
|
||||
|
||||
/* Initialize libtransmission */
|
||||
h = tr_initFull( tr_getDefaultConfigDir(),
|
||||
"cli", /* tag */
|
||||
|
||||
@@ -110,11 +110,12 @@ incomingPeersPulse( tr_shared * s )
|
||||
s->bindSocket = -1;
|
||||
}
|
||||
|
||||
if( s->bindPort != s->publicPort )
|
||||
if( ( s->publicPort > 0 ) && ( s->bindPort != s->publicPort ) )
|
||||
{
|
||||
int socket;
|
||||
errno = 0;
|
||||
socket = tr_netBindTCP( s->publicPort );
|
||||
fprintf( stderr, "opening socket on %d to listen\n", s->publicPort );
|
||||
if( socket >= 0 ) {
|
||||
tr_ninf( getKey(), _( "Opened port %d to listen for incoming peer connections" ), s->publicPort );
|
||||
s->bindPort = s->publicPort;
|
||||
|
||||
Reference in New Issue
Block a user