Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ipc.c

    rba9edaa rdd89a55  
    6060                ipc_to_children_str( "DIE\r\n" );
    6161       
    62         bitlbee_shutdown( NULL, -1, 0 );
     62        bitlbee_shutdown( NULL );
    6363}
    6464
     
    9191       
    9292        global.restart = -1;
    93         bitlbee_shutdown( NULL, -1, 0 );
     93        bitlbee_shutdown( NULL );
    9494}
    9595
     
    246246}
    247247
    248 gboolean ipc_master_read( gpointer data, gint source, b_input_condition cond )
     248void ipc_master_read( gpointer data, gint source, GaimInputCondition cond )
    249249{
    250250        char *buf, **cmd;
     
    272272                }
    273273        }
    274        
    275         return TRUE;
    276 }
    277 
    278 gboolean ipc_child_read( gpointer data, gint source, b_input_condition cond )
     274}
     275
     276void ipc_child_read( gpointer data, gint source, GaimInputCondition cond )
    279277{
    280278        char *buf, **cmd;
     
    288286        else
    289287        {
    290                 b_event_remove( global.listen_watch_source_id );
     288                gaim_input_remove( global.listen_watch_source_id );
    291289                close( global.listen_socket );
    292290               
    293291                global.listen_socket = -1;
    294292        }
    295        
    296         return TRUE;
    297293}
    298294
     
    401397void ipc_master_free_one( struct bitlbee_child *c )
    402398{
    403         b_event_remove( c->ipc_inpa );
     399        gaim_input_remove( c->ipc_inpa );
    404400        closesocket( c->ipc_fd );
    405401       
     
    467463
    468464
    469 static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond )
     465static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer data)
    470466{
    471467        struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 );
    472        
    473         child->ipc_fd = accept( serversock, NULL, 0 );
    474        
    475         if( child->ipc_fd == -1 )
    476         {
     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) {
    477475                log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) );
    478476                return TRUE;
    479477        }
    480478               
    481         child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    482        
     479        child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     480               
    483481        child_list = g_slist_append( child_list, child );
    484        
     482
    485483        return TRUE;
    486484}
     
    491489        struct sockaddr_un un_addr;
    492490        int serversock;
     491        GIOChannel *gio;
    493492
    494493        /* Clean up old socket files that were hanging around.. */
     
    508507        }
    509508
    510         if (bind(serversock, &un_addr, sizeof(un_addr)) == -1) {
     509        if (bind(serversock, (struct sockaddr *)&un_addr, sizeof(un_addr)) == -1) {
    511510                log_message( LOGLVL_WARNING, "Unable to bind UNIX socket to %s: %s", IPCSOCKET, strerror(errno) );
    512511                return 0;
     
    518517        }
    519518       
    520         b_input_add( serversock, GAIM_INPUT_READ, new_ipc_client, NULL );
    521        
     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);
    522527        return 1;
    523528}
     
    558563                        return 0;
    559564                }
    560                 child->ipc_inpa = b_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     565                child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
    561566               
    562567                child_list = g_slist_append( child_list, child );
     
    566571        ipc_to_children_str( "OPERMSG :New BitlBee master process started (version " BITLBEE_VERSION ")\r\n" );
    567572       
     573        fclose( fp );
    568574        return 1;
    569575}
Note: See TracChangeset for help on using the changeset viewer.