mirror of
https://github.com/transmission/transmission
synced 2025-03-11 22:52:53 +00:00
Shut down ipc server on fatal signal, not just torrent client.
This commit is contained in:
parent
78f65331f2
commit
aafd6488af
3 changed files with 18 additions and 11 deletions
|
@ -344,7 +344,7 @@ gotsig( int sig, short what UNUSED, void * arg UNUSED )
|
|||
{
|
||||
exiting = 1;
|
||||
errmsg( "received fatal signal %i, attempting to exit cleanly", sig );
|
||||
torrent_exit( 0 );
|
||||
server_quit();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -185,6 +185,21 @@ server_listen( int fd )
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
server_quit( void )
|
||||
{
|
||||
struct client * ii, * next;
|
||||
|
||||
torrent_exit( 0 );
|
||||
gl_exiting = 1;
|
||||
|
||||
for( ii = RB_MIN( allclients, &gl_clients ); NULL != ii; ii = next )
|
||||
{
|
||||
next = RB_NEXT( allclients, &gl_clients, ii );
|
||||
byebye( ii->ev, EVBUFFER_EOF, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
newclient( int fd, short event UNUSED, void * arg )
|
||||
{
|
||||
|
@ -560,16 +575,7 @@ void
|
|||
quitmsg( enum ipc_msg id UNUSED, benc_val_t * val UNUSED, int64_t tag UNUSED,
|
||||
void * arg UNUSED )
|
||||
{
|
||||
struct client * ii, * next;
|
||||
|
||||
torrent_exit( 0 );
|
||||
gl_exiting = 1;
|
||||
|
||||
for( ii = RB_MIN( allclients, &gl_clients ); NULL != ii; ii = next )
|
||||
{
|
||||
next = RB_NEXT( allclients, &gl_clients, ii );
|
||||
byebye( ii->ev, EVBUFFER_EOF, NULL );
|
||||
}
|
||||
server_quit();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -30,5 +30,6 @@ struct event_base;
|
|||
int server_init( struct event_base * );
|
||||
void server_debug( int );
|
||||
int server_listen( int );
|
||||
void server_quit( void );
|
||||
|
||||
#endif /* TR_DAEMON_SERVER_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue