Changeset 6dff9d4


Ignore:
Timestamp:
2006-03-01T21:08:03Z (15 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
8a56e52
Parents:
7cf85e7
Message:

Also listen for admin connections on a unix domain socket at /var/run/bitlbee

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    r7cf85e7 r6dff9d4  
    118118        if( global.conf->runmode == RUNMODE_FORKDAEMON )
    119119                ipc_master_load_state();
     120
     121        if( global.conf->runmode == RUNMODE_DAEMON ||
     122                global.conf->runmode == RUNMODE_FORKDAEMON )
     123                ipc_master_listen_socket();
    120124       
    121125        if( ( fp = fopen( global.conf->pidfile, "w" ) ) )
  • configure

    r7cf85e7 r6dff9d4  
    1515config='/var/lib/bitlbee/'
    1616pidfile='/var/run/bitlbee.pid'
     17ipcsocket='/var/run/bitlbee'
    1718plugindir='$prefix/lib/bitlbee'
    1819
     
    4950--pidfile=...                                           $pidfile
    5051--config=...                                            $config
     52--ipcsocket=...                                         $ipcsocket
    5153
    5254--msn=0/1       Disable/enable MSN part                 $msn
     
    7678config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
    7779plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
    78 pidfile=`eval echo "$pidfile/" | sed 's/\/\{1,\}/\//g'`
     80pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
     81ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
    7982
    8083cat<<EOF>Makefile.settings
     
    8689DATADIR=$datadir
    8790PLUGINDIR=$plugindir
    88 PIDFILE=$pidfile
    8991CONFIG=$config
     92IPCSOCKET=$ipcsocket
    9093
    9194ARCH=$arch
     
    109112#define PLUGINDIR "$plugindir"
    110113#define PIDFILE "$pidfile"
     114#define IPCSOCKET "$ipcsocket"
    111115#define ARCH "$arch"
    112116#define CPU "$cpu"
  • ipc.c

    r7cf85e7 r6dff9d4  
    2828#include "ipc.h"
    2929#include "commands.h"
     30#ifndef _WIN32
     31#include <sys/un.h>
     32#endif
    3033
    3134GSList *child_list = NULL;
     
    457460}
    458461
     462
     463static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer data)
     464{
     465        struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 );
     466        int serversock;
     467
     468        serversock = g_io_channel_unix_get_fd(gio);
     469
     470        child->ipc_fd = accept(serversock, NULL, 0);
     471               
     472        child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child );
     473               
     474        child_list = g_slist_append( child_list, child );
     475
     476        return TRUE;
     477}
     478
     479#ifndef _WIN32
     480int ipc_master_listen_socket()
     481{
     482        struct sockaddr_un un_addr;
     483        int serversock;
     484        GIOChannel *gio;
     485
     486        /* Clean up old socket files that were hanging around.. */
     487        unlink(IPCSOCKET);
     488
     489        un_addr.sun_family = AF_UNIX;
     490        strcpy(un_addr.sun_path, IPCSOCKET);
     491
     492        serversock = socket(AF_UNIX, SOCK_STREAM, PF_UNIX);
     493
     494        bind(serversock, &un_addr, sizeof(un_addr));
     495
     496        listen(serversock, 5);
     497       
     498        gio = g_io_channel_unix_new(serversock);
     499
     500        g_io_add_watch(gio, G_IO_IN, new_ipc_client, NULL);
     501        return 1;
     502}
     503#else
     504        /* FIXME: Open named pipe \\.\BITLBEE */
     505#endif
     506
    459507int ipc_master_load_state()
    460508{
  • ipc.h

    r7cf85e7 r6dff9d4  
    5757void ipc_master_set_statefile( char *fn );
    5858int ipc_master_load_state();
    59 
     59int ipc_master_listen_socket();
    6060
    6161extern GSList *child_list;
Note: See TracChangeset for help on using the changeset viewer.