Changes in ipc.c [171ef85:52744f8]
Legend:
- Unmodified
- Added
- Removed
-
ipc.c
r171ef85 r52744f8 258 258 else 259 259 { 260 ipc_master_free_fd( source ); 260 GSList *l; 261 struct bitlbee_child *c; 262 263 for( l = child_list; l; l = l->next ) 264 { 265 c = l->data; 266 if( c->ipc_fd == source ) 267 { 268 ipc_master_free_one( c ); 269 child_list = g_slist_remove( child_list, c ); 270 break; 271 } 272 } 261 273 } 262 274 … … 276 288 else 277 289 { 278 ipc_child_disable(); 290 b_event_remove( global.listen_watch_source_id ); 291 close( global.listen_socket ); 292 293 global.listen_socket = -1; 279 294 } 280 295 … … 311 326 else if( global.conf->runmode == RUNMODE_FORKDAEMON ) 312 327 { 313 if( global.listen_socket >= 0 ) 314 if( write( global.listen_socket, msg_buf, strlen( msg_buf ) ) <= 0 ) 315 ipc_child_disable(); 328 write( global.listen_socket, msg_buf, strlen( msg_buf ) ); 316 329 } 317 330 else if( global.conf->runmode == RUNMODE_DAEMON ) … … 363 376 { 364 377 int msg_len = strlen( msg_buf ); 365 GSList *l , *next;366 367 for( l = child_list; l; l = next )378 GSList *l; 379 380 for( l = child_list; l; l = l->next ) 368 381 { 369 382 struct bitlbee_child *c = l->data; 370 371 next = l->next; 372 if( write( c->ipc_fd, msg_buf, msg_len ) <= 0 ) 373 { 374 ipc_master_free_one( c ); 375 child_list = g_slist_remove( child_list, c ); 376 } 383 write( c->ipc_fd, msg_buf, msg_len ); 377 384 } 378 385 } … … 403 410 } 404 411 405 void ipc_master_free_fd( int fd )406 {407 GSList *l;408 struct bitlbee_child *c;409 410 for( l = child_list; l; l = l->next )411 {412 c = l->data;413 if( c->ipc_fd == fd )414 {415 ipc_master_free_one( c );416 child_list = g_slist_remove( child_list, c );417 break;418 }419 }420 }421 422 412 void ipc_master_free_all() 423 413 { … … 429 419 g_slist_free( child_list ); 430 420 child_list = NULL; 431 }432 433 void ipc_child_disable()434 {435 b_event_remove( global.listen_watch_source_id );436 close( global.listen_socket );437 438 global.listen_socket = -1;439 421 } 440 422
Note: See TracChangeset
for help on using the changeset viewer.