diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2008-06-29 10:35:41 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2008-06-29 10:35:41 +0100 | 
| commit | 565a1eaa8b36ca64a7806e6ad74a9a26495c0c6e (patch) | |
| tree | c6d404b6600b4e10b7b0d5bd4d4c185f4954e4ac /ipc.c | |
| parent | e0f9170849e9c4aaa679f86703a60686d36607bb (diff) | |
Added the DEAF command, which makes the daemon stop listening for new
connections. This makes it easier to upgrade a BitlBee without having
to disconnect all current users immediately. Closes #428.
Diffstat (limited to 'ipc.c')
| -rw-r--r-- | ipc.c | 20 | 
1 files changed, 20 insertions, 0 deletions
| @@ -62,6 +62,25 @@ static void ipc_master_cmd_die( irc_t *data, char **cmd )  	bitlbee_shutdown( NULL, -1, 0 );  } +static void ipc_master_cmd_deaf( irc_t *data, char **cmd ) +{ +	if( global.conf->runmode == RUNMODE_DAEMON ) +	{ +		b_event_remove( global.listen_watch_source_id ); +		close( global.listen_socket ); +		 +		global.listen_socket = global.listen_watch_source_id = -1; +	 +		ipc_to_children_str( "OPERMSG :Closed listening socket, waiting " +		                     "for all users to disconnect." ); +	} +	else +	{ +		ipc_to_children_str( "OPERMSG :The DEAF command only works in " +		                     "normal daemon mode. Try DIE instead." ); +	} +} +  void ipc_master_cmd_rehash( irc_t *data, char **cmd )  {  	runmode_t oldmode; @@ -97,6 +116,7 @@ static const command_t ipc_master_commands[] = {  	{ "client",     3, ipc_master_cmd_client,     0 },  	{ "hello",      0, ipc_master_cmd_client,     0 },  	{ "die",        0, ipc_master_cmd_die,        0 }, +	{ "deaf",       0, ipc_master_cmd_deaf,       0 },  	{ "wallops",    1, NULL,                      IPC_CMD_TO_CHILDREN },  	{ "wall",       1, NULL,                      IPC_CMD_TO_CHILDREN },  	{ "opermsg",    1, NULL,                      IPC_CMD_TO_CHILDREN }, | 
