mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
(trunk libT) #3078 "Transmission closes socket after SIGHUP" -- experimental fix
This commit is contained in:
parent
ceb95424c4
commit
ef2fd245cf
1 changed files with 12 additions and 5 deletions
|
@ -627,6 +627,7 @@ tr_sessionInitImpl( void * vdata )
|
|||
}
|
||||
|
||||
static void turtleBootstrap( tr_session *, struct tr_turtle_info * );
|
||||
static void setPeerPort( tr_session * session, tr_port port );
|
||||
|
||||
static void
|
||||
sessionSetImpl( void * vdata )
|
||||
|
@ -735,7 +736,7 @@ sessionSetImpl( void * vdata )
|
|||
tr_sessionSetPeerPortRandomOnStart( session, boolVal );
|
||||
if( !tr_bencDictFindInt( settings, TR_PREFS_KEY_PEER_PORT, &i ) )
|
||||
i = session->peerPort;
|
||||
tr_sessionSetPeerPort( session, boolVal ? getRandomPort( session ) : i );
|
||||
setPeerPort( session, boolVal ? getRandomPort( session ) : i );
|
||||
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_PORT_FORWARDING, &boolVal ) )
|
||||
tr_sessionSetPortForwardingEnabled( session, boolVal );
|
||||
|
||||
|
@ -946,7 +947,7 @@ tr_sessionIsLocked( const tr_session * session )
|
|||
**********************************************************************/
|
||||
|
||||
static void
|
||||
setPeerPort( void * session )
|
||||
peerPortChanged( void * session )
|
||||
{
|
||||
tr_torrent * tor = NULL;
|
||||
|
||||
|
@ -960,6 +961,14 @@ setPeerPort( void * session )
|
|||
tr_torrentChangeMyPort( tor );
|
||||
}
|
||||
|
||||
static void
|
||||
setPeerPort( tr_session * session, tr_port port )
|
||||
{
|
||||
session->peerPort = port;
|
||||
|
||||
tr_runInEventThread( session, peerPortChanged, session );
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetPeerPort( tr_session * session, tr_port port )
|
||||
{
|
||||
|
@ -967,9 +976,7 @@ tr_sessionSetPeerPort( tr_session * session, tr_port port )
|
|||
|
||||
if( session->peerPort != port )
|
||||
{
|
||||
session->peerPort = port;
|
||||
|
||||
tr_runInEventThread( session, setPeerPort, session );
|
||||
setPeerPort( session, port );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue