mirror of
https://github.com/transmission/transmission
synced 2025-01-31 19:34:05 +00:00
#846: transmissioncli attempts to bind to port even when not needed
This commit is contained in:
parent
d9ff2d6105
commit
f42995c872
2 changed files with 7 additions and 1 deletions
|
@ -139,6 +139,11 @@ main( int argc, char ** argv )
|
||||||
return EXIT_FAILURE;
|
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 */
|
/* Initialize libtransmission */
|
||||||
h = tr_initFull( tr_getDefaultConfigDir(),
|
h = tr_initFull( tr_getDefaultConfigDir(),
|
||||||
"cli", /* tag */
|
"cli", /* tag */
|
||||||
|
|
|
@ -110,11 +110,12 @@ incomingPeersPulse( tr_shared * s )
|
||||||
s->bindSocket = -1;
|
s->bindSocket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s->bindPort != s->publicPort )
|
if( ( s->publicPort > 0 ) && ( s->bindPort != s->publicPort ) )
|
||||||
{
|
{
|
||||||
int socket;
|
int socket;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
socket = tr_netBindTCP( s->publicPort );
|
socket = tr_netBindTCP( s->publicPort );
|
||||||
|
fprintf( stderr, "opening socket on %d to listen\n", s->publicPort );
|
||||||
if( socket >= 0 ) {
|
if( socket >= 0 ) {
|
||||||
tr_ninf( getKey(), _( "Opened port %d to listen for incoming peer connections" ), s->publicPort );
|
tr_ninf( getKey(), _( "Opened port %d to listen for incoming peer connections" ), s->publicPort );
|
||||||
s->bindPort = s->publicPort;
|
s->bindPort = s->publicPort;
|
||||||
|
|
Loading…
Reference in a new issue