Changeset 82ca986
- Timestamp:
- 2010-07-27T17:45:16Z (14 years ago)
- Branches:
- master
- Children:
- f6f5eee
- Parents:
- a7dbf45
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
ra7dbf45 r82ca986 372 372 /* Try to save data for all active connections (if desired). */ 373 373 while( irc_connection_list != NULL ) 374 irc_abort( irc_connection_list->data, FALSE,374 irc_abort( irc_connection_list->data, TRUE, 375 375 "BitlBee server shutting down" ); 376 376 -
ipc.c
ra7dbf45 r82ca986 421 421 422 422 if( old ) 423 {424 irc->status |= USTATUS_SHUTDOWN;425 423 irc_abort( irc, FALSE, NULL ); 426 }427 424 } 428 425 -
irc.c
ra7dbf45 r82ca986 161 161 void irc_abort( irc_t *irc, int immed, char *format, ... ) 162 162 { 163 char *reason = NULL; 164 163 165 if( format != NULL ) 164 166 { 165 167 va_list params; 166 char *reason;167 168 168 169 va_start( params, format ); 169 170 reason = g_strdup_vprintf( format, params ); 170 171 va_end( params ); 171 172 if( !immed ) 173 irc_write( irc, "ERROR :Closing link: %s", reason ); 174 175 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 176 irc->user->nick ? irc->user->nick : "(NONE)", irc->user->host, reason ); 177 178 g_free( reason ); 172 } 173 174 irc_write( irc, "ERROR :Closing link: %s", reason ? : "" ); 175 176 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 177 irc->user->nick ? irc->user->nick : "(NONE)", 178 irc->user->host, reason ? : "" ); 179 180 g_free( reason ); 181 182 irc_flush( irc ); 183 if( immed ) 184 { 185 irc_free( irc ); 179 186 } 180 187 else 181 188 { 182 if( !immed ) 183 irc_write( irc, "ERROR :Closing link" ); 184 185 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 186 irc->user->nick ? irc->user->nick : "(NONE)", irc->user->host, "No reason given" ); 187 } 188 189 b_event_remove( irc->ping_source_id ); 190 irc->ping_source_id = b_timeout_add( 1, (b_event_handler) irc_free, irc ); 191 } 192 } 193 194 static gboolean irc_free_hashkey( gpointer key, gpointer value, gpointer data ); 195 196 void irc_free( irc_t * irc ) 197 { 189 198 irc->status |= USTATUS_SHUTDOWN; 190 if( irc->sendbuffer && !immed ) 191 { 192 /* Set up a timeout event that should shut down the connection 193 in a second, just in case ..._write doesn't do it first. */ 194 195 b_event_remove( irc->r_watch_source_id ); 196 irc->r_watch_source_id = 0; 197 198 b_event_remove( irc->ping_source_id ); 199 irc->ping_source_id = b_timeout_add( 1000, (b_event_handler) irc_free, irc ); 200 } 201 else 202 { 203 irc_free( irc ); 204 } 205 } 206 207 static gboolean irc_free_hashkey( gpointer key, gpointer value, gpointer data ); 208 209 void irc_free( irc_t * irc ) 210 { 199 211 200 log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd ); 212 201 -
unix.c
ra7dbf45 r82ca986 239 239 /* FIXME: Calling log_message() here is not a very good idea! */ 240 240 241 if( signal == SIGTERM )241 if( signal == SIGTERM || signal == SIGQUIT || signal == SIGINT ) 242 242 { 243 243 static int first = 1;
Note: See TracChangeset
for help on using the changeset viewer.