Ignore:
Timestamp:
2007-12-05T01:30:50Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
dc0ba9c
Parents:
dce3903 (diff), 793cc25 (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:

merges from upstream/release

ulim 2007-12-04 Follow rename of jabber_chat_by_jid from upstrem

ulim 2007-12-04 Merged in current devel
Wilmer van der Gaast 2007-12-02 Imported setuid() patch from Simo Leone <simo@archlinux...> with some
Wilmer van der Gaast 2007-12-02 Forgot to return something in jabber_chat_join_failed().
Wilmer van der Gaast 2007-12-02 Merging a change I should've pulled before committing three other changes.
Wilmer van der Gaast 2007-12-02 Added charset checks on incoming msgs (from the IRC side) to prevent possible
Wilmer van der Gaast 2007-12-02 Handling of presence-error packets (only useful for groupchats now), moved
Wilmer van der Gaast 2007-12-02 Defining DEBUG via CFLAGS so that it'll always be there, even when a file
ulim 2007-12-04 Jabber file transfer now also with sending! You can't use a proxy yet when
Wilmer van der Gaast 2007-12-02 Removed retarded printf() (ARGH) and moved the event handling handling of
Wilmer van der Gaast 2007-11-29 printf() in daemons considered harmful.
Wilmer van der Gaast 2007-11-28 Fixed the epoll+ForkDaemon combination. The libevent event handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/events_libevent.c

    rdce3903 r8076ec0  
    3232#include <unistd.h>
    3333#include <sys/types.h>
    34 #include "proxy.h"
    35 
    3634#include <sys/time.h>
    3735#include <event.h>
    38 
    39 static guint id_next;
     36#include "proxy.h"
     37
     38static void b_main_restart();
     39static guint id_next = 1;
    4040static GHashTable *id_hash;
    4141static int quitting = 0;
     
    4848static GHashTable *write_hash;
    4949
     50struct event_base *leh;
     51struct event_base *old_leh;
     52
    5053struct b_event_data
    5154{
     
    5962void b_main_init()
    6063{
    61         event_init();
    62        
    63         id_next = 1;
     64        if( leh != NULL )
     65        {
     66                /* Clean up the hash tables? */
     67               
     68                b_main_restart();
     69                old_leh = leh;
     70        }
     71       
     72        leh = event_init();
     73       
    6474        id_hash = g_hash_table_new( g_int_hash, g_int_equal );
    6575        read_hash = g_hash_table_new( g_int_hash, g_int_equal );
     
    6979void b_main_run()
    7080{
    71         event_dispatch();
     81        /* This while loop is necessary to exit the event loop and start a
     82           different one (necessary for ForkDaemon mode). */
     83        while( event_base_dispatch( leh ) == 0 && !quitting )
     84        {
     85                if( old_leh != NULL )
     86                {
     87                        /* For some reason this just isn't allowed...
     88                           Possibly a bug in older versions, will see later.
     89                        event_base_free( old_leh ); */
     90                        old_leh = NULL;
     91                }
     92               
     93                event_debug( "New event loop.\n" );
     94        }
     95}
     96
     97static void b_main_restart()
     98{
     99        struct timeval tv;
     100       
     101        memset( &tv, 0, sizeof( struct timeval ) );
     102        event_base_loopexit( leh, &tv );
     103       
     104        event_debug( "b_main_restart()\n" );
    72105}
    73106
    74107void b_main_quit()
    75108{
    76         struct timeval tv;
    77        
    78         /* libevent sometimes generates events before really quitting,
     109        /* Tell b_main_run() that it shouldn't restart the loop. Also,
     110           libevent sometimes generates events before really quitting,
    79111           we want to stop them. */
    80112        quitting = 1;
    81113       
    82         memset( &tv, 0, sizeof( struct timeval ) );
    83         event_loopexit( &tv );
     114        b_main_restart();
    84115}
    85116
Note: See TracChangeset for help on using the changeset viewer.