Changeset 565a1ea


Ignore:
Timestamp:
2008-06-29T09:35:41Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1145964
Parents:
e0f9170
Message:

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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ipc.c

    re0f9170 r565a1ea  
    6363}
    6464
     65static void ipc_master_cmd_deaf( irc_t *data, char **cmd )
     66{
     67        if( global.conf->runmode == RUNMODE_DAEMON )
     68        {
     69                b_event_remove( global.listen_watch_source_id );
     70                close( global.listen_socket );
     71               
     72                global.listen_socket = global.listen_watch_source_id = -1;
     73       
     74                ipc_to_children_str( "OPERMSG :Closed listening socket, waiting "
     75                                     "for all users to disconnect." );
     76        }
     77        else
     78        {
     79                ipc_to_children_str( "OPERMSG :The DEAF command only works in "
     80                                     "normal daemon mode. Try DIE instead." );
     81        }
     82}
     83
    6584void ipc_master_cmd_rehash( irc_t *data, char **cmd )
    6685{
     
    98117        { "hello",      0, ipc_master_cmd_client,     0 },
    99118        { "die",        0, ipc_master_cmd_die,        0 },
     119        { "deaf",       0, ipc_master_cmd_deaf,       0 },
    100120        { "wallops",    1, NULL,                      IPC_CMD_TO_CHILDREN },
    101121        { "wall",       1, NULL,                      IPC_CMD_TO_CHILDREN },
  • irc.c

    re0f9170 r565a1ea  
    314314        g_free( irc );
    315315       
    316         if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON )
     316        if( global.conf->runmode == RUNMODE_INETD ||
     317            global.conf->runmode == RUNMODE_FORKDAEMON ||
     318            ( global.conf->runmode == RUNMODE_DAEMON &&
     319              global.listen_socket == -1 &&
     320              irc_connection_list == NULL ) )
    317321                b_main_quit();
    318322}
  • irc_commands.c

    re0f9170 r565a1ea  
    626626        { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN },
    627627        { "die",         0, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
     628        { "deaf",        0, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
    628629        { "wallops",     1, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
    629630        { "wall",        1, NULL,                IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },
Note: See TracChangeset for help on using the changeset viewer.