Changeset b72caac for ipc.c


Ignore:
Timestamp:
2006-06-21T16:34:33Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
59f5c42a
Parents:
3af70b0 (diff), df417ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging libevent branch: Events can now be handles by both glib and libevent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ipc.c

    r3af70b0 rb72caac  
    6060                ipc_to_children_str( "DIE\r\n" );
    6161       
    62         bitlbee_shutdown( NULL );
     62        bitlbee_shutdown( NULL, -1, 0 );
    6363}
    6464
     
    9191       
    9292        global.restart = -1;
    93         bitlbee_shutdown( NULL );
     93        bitlbee_shutdown( NULL, -1, 0 );
    9494}
    9595
     
    246246}
    247247
    248 void ipc_master_read( gpointer data, gint source, GaimInputCondition cond )
     248gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond )
    249249{
    250250        char *buf, **cmd;
     
    272272                }
    273273        }
    274 }
    275 
    276 void ipc_child_read( gpointer data, gint source, GaimInputCondition cond )
     274       
     275        return TRUE;
     276}
     277
     278gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond )
    277279{
    278280        char *buf, **cmd;
     
    286288        else
    287289        {
    288                 gaim_input_remove( global.listen_watch_source_id );
     290                b_event_remove( global.listen_watch_source_id );
    289291                close( global.listen_socket );
    290292               
    291293                global.listen_socket = -1;
    292294        }
     295       
     296        return TRUE;
    293297}
    294298
     
    397401void ipc_master_free_one( struct bitlbee_child *c )
    398402{
    399         gaim_input_remove( c->ipc_inpa );
     403        b_event_remove( c->ipc_inpa );
    400404        closesocket( c->ipc_fd );
    401405       
     
    463467
    464468
    465 static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer data)
     469static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond )
    466470{
    467471        struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 );
    468         int serversock;
    469 
    470         serversock = g_io_channel_unix_get_fd(gio);
    471 
    472         child->ipc_fd = accept(serversock, NULL, 0);
    473 
    474         if (child->ipc_fd == -1) {
     472       
     473        child->ipc_fd = accept( serversock, NULL, 0 );
     474       
     475        if( child->ipc_fd == -1 )
     476        {
    475477                log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) );
    476478                return TRUE;
    477479        }
    478480               
    479         child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    480                
     481        child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     482       
    481483        child_list = g_slist_append( child_list, child );
    482 
     484       
    483485        return TRUE;
    484486}
     
    489491        struct sockaddr_un un_addr;
    490492        int serversock;
    491         GIOChannel *gio;
    492493
    493494        /* Clean up old socket files that were hanging around.. */
     
    517518        }
    518519       
    519         gio = g_io_channel_unix_new(serversock);
    520        
    521         if (gio == NULL) {
    522                 log_message( LOGLVL_WARNING, "Unable to create IO channel for unix socket" );
    523                 return 0;
    524         }
    525 
    526         g_io_add_watch(gio, G_IO_IN, new_ipc_client, NULL);
     520        b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
     521       
    527522        return 1;
    528523}
     
    563558                        return 0;
    564559                }
    565                 child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     560                child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    566561               
    567562                child_list = g_slist_append( child_list, child );
Note: See TracChangeset for help on using the changeset viewer.