Add iomux_from_timers() function to recover an IOMux from
the associated UCTimers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#define DEBUG
|
||||
#include <getopt.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@@ -76,6 +77,7 @@ void peer_timer_cb(struct UCTimers *timers, struct UCTimer *timer)
|
||||
struct HBPeer *peer = UC_CONTAINER_OF(timer, struct HBPeer, timer);
|
||||
struct HBContext *ctx = timer->cookie_ptr;
|
||||
time_t now;
|
||||
struct IOMux *mux;
|
||||
|
||||
uc_timers_add(timers, timer, PEER_HB_MISS , 0);
|
||||
now = time(NULL);
|
||||
@@ -85,6 +87,9 @@ void peer_timer_cb(struct UCTimers *timers, struct UCTimer *timer)
|
||||
}
|
||||
|
||||
peer_send(ctx, peer);
|
||||
//jsut a small test of iomux_from_timers
|
||||
mux = iomux_from_timers(timers);
|
||||
assert(mux == ctx->mux);
|
||||
}
|
||||
|
||||
void peer_add_addr(struct HBContext *ctx, const struct sockaddr_in *addr)
|
||||
|
||||
Reference in New Issue
Block a user