osmux: remove timeval parameter from osmux_tx_sched

We can internal allocate this in the stack, no need to expose it to
the caller.
This commit is contained in:
Pablo Neira Ayuso 2012-08-04 21:03:56 +02:00
parent 81979fa80a
commit d2ea108728
3 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);
}
}