diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h index b84b119..47fbd95 100644 --- a/include/osmocom/netif/osmux.h +++ b/include/osmocom/netif/osmux.h @@ -63,6 +63,6 @@ void osmux_xfrm_input_deliver(struct osmux_in_handle *h); int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list); struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg); -void osmux_tx_sched(struct llist_head *list, struct timeval *when, void (*tx_cb)(struct msgb *msg, void *data), void *data); +void osmux_tx_sched(struct llist_head *list, void (*tx_cb)(struct msgb *msg, void *data), void *data); #endif diff --git a/src/osmux.c b/src/osmux.c index 2132a91..98b1e27 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -424,19 +424,22 @@ osmux_tx(struct msgb *msg, struct timeval *when, } void -osmux_tx_sched(struct llist_head *list, struct timeval *when, +osmux_tx_sched(struct llist_head *list, void (*tx_cb)(struct msgb *msg, void *data), void *data) { struct msgb *cur, *tmp; struct timeval delta = { .tv_sec = 0, .tv_usec = DELTA_RTP_MSG }; + struct timeval when; + + timerclear(&when); llist_for_each_entry_safe(cur, tmp, list, list) { LOGP(DOSMUX, LOGL_DEBUG, "scheduled transmision in %lu.%6lu " - "seconds, msg=%p\n", when->tv_sec, when->tv_usec, cur); + "seconds, msg=%p\n", when.tv_sec, when.tv_usec, cur); - osmux_tx(cur, when, tx_cb, NULL); - timeradd(when, &delta, when); + osmux_tx(cur, &when, tx_cb, NULL); + timeradd(&when, &delta, &when); llist_del(&cur->list); } } diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c index f45f1fd..1c936b7 100644 --- a/tests/osmo-pcap-test/osmux_test.c +++ b/tests/osmo-pcap-test/osmux_test.c @@ -52,18 +52,15 @@ static void tx_cb(struct msgb *msg, void *data) static void deliver(struct msgb *batch_msg) { struct osmux_hdr *osmuxh; - struct timeval tv; struct llist_head list; - timerclear(&tv); - printf("sending batch (len=%d) [emulated]\n", batch_msg->len); /* This code below belongs to the osmux receiver */ while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) { osmux_xfrm_output(osmuxh, &h_output, &list); - osmux_tx_sched(&list, &tv, tx_cb, NULL); + osmux_tx_sched(&list, tx_cb, NULL); } }