Add iomux_from_timers() function to recover an IOMux from

the associated UCTimers
This commit is contained in:
Nils O. Selåsdal
2014-06-22 23:11:12 +02:00
parent 2c264a76b4
commit 2d1e7efc3e
4 changed files with 16 additions and 1 deletions
+5
View File
@@ -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)