aboutsummaryrefslogtreecommitdiffstats
path: root/irc.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2008-04-02 22:36:02 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2008-04-02 22:36:02 +0100
commit883a398f059f98cb31da77dd6e632e4152dcf87e (patch)
treee08f8b2f53ce24b0647fe3a3d3cb3931b5d543f8 /irc.c
parentfa75134008bd9206ca02380927c27581feb65c3e (diff)
Rearranged some event handling code.
Diffstat (limited to 'irc.c')
-rw-r--r--irc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/irc.c b/irc.c
index 585cf232..c929d68b 100644
--- a/irc.c
+++ b/irc.c
@@ -198,12 +198,14 @@ void irc_abort( irc_t *irc, int immed, char *format, ... )
irc->status |= USTATUS_SHUTDOWN;
if( irc->sendbuffer && !immed )
{
- /* We won't read from this socket anymore. Instead, we'll connect a timer
- to it that should shut down the connection in a second, just in case
- bitlbee_.._write doesn't do it first. */
+ /* Set up a timeout event that should shut down the connection
+ in a second, just in case ..._write doesn't do it first. */
b_event_remove( irc->r_watch_source_id );
- irc->r_watch_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc );
+ irc->r_watch_source_id = 0;
+
+ b_event_remove( irc->ping_source_id );
+ irc->ping_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc );
}
else
{
@@ -273,7 +275,8 @@ void irc_free( irc_t * irc )
if( irc->ping_source_id > 0 )
b_event_remove( irc->ping_source_id );
- b_event_remove( irc->r_watch_source_id );
+ if( irc->r_watch_source_id > 0 )
+ b_event_remove( irc->r_watch_source_id );
if( irc->w_watch_source_id > 0 )
b_event_remove( irc->w_watch_source_id );