diff options
Diffstat (limited to 'irc.c')
| -rw-r--r-- | irc.c | 13 | 
1 files changed, 8 insertions, 5 deletions
| @@ -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 ); | 
