diff options
Diffstat (limited to 'protocols/events_libevent.c')
-rw-r--r-- | protocols/events_libevent.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/protocols/events_libevent.c b/protocols/events_libevent.c index d4767348..6e1ed98e 100644 --- a/protocols/events_libevent.c +++ b/protocols/events_libevent.c @@ -49,6 +49,7 @@ struct b_event_data { guint id; struct event evinfo; + gint timeout; b_event_handler function; void *data; }; @@ -101,6 +102,15 @@ static void b_event_passthrough( int fd, short event, void *data ) event_debug( "Handler returned FALSE: " ); b_event_remove( id ); } + else if( fd == -1 ) + { + struct timeval tv; + + tv.tv_sec = b_ev->timeout / 1000; + tv.tv_usec = ( b_ev->timeout % 1000 ) * 1000; + + evtimer_add( &b_ev->evinfo, &tv ); + } } gint b_input_add( gint fd, b_input_condition condition, b_event_handler function, gpointer data ) @@ -158,6 +168,7 @@ gint b_timeout_add( gint timeout, b_event_handler function, gpointer data ) struct timeval tv; b_ev->id = id_next++; + b_ev->timeout = timeout; b_ev->function = function; b_ev->data = data; |