summaryrefslogtreecommitdiffstats
path: root/ffd/ack.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-10-21 05:32:43 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-10-21 05:32:43 +0200
commit758611ccd2a8ce105258cf766fc5aa7b0719ae95 (patch)
treefc5260a8fa2c2489e0b7234535e617e0554cf784 /ffd/ack.c
parentaa15b96d39dd0242c33b7a11c7c02ebdba50f150 (diff)
downloadffd-758611ccd2a8ce105258cf766fc5aa7b0719ae95.tar
ffd-758611ccd2a8ce105258cf766fc5aa7b0719ae95.zip
Use acked updates for seqno request replies
Diffstat (limited to 'ffd/ack.c')
-rw-r--r--ffd/ack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ffd/ack.c b/ffd/ack.c
index 0dbb13c..cd21d0f 100644
--- a/ffd/ack.c
+++ b/ffd/ack.c
@@ -40,6 +40,7 @@ static uint16_t nonce = 0;
typedef struct _ack_arg_t {
void (*cb)(uint16_t nonce, void *arg);
+ void (*free)(uint16_t nonce, void *arg);
void *arg;
uint16_t nonce;
@@ -56,6 +57,7 @@ static void ack_resend(const struct timespec *timeout, void *argp) {
ack_arg_t *arg = argp;
if (GET_ACK(arg->nonce) || !(--arg->retries)) {
+ arg->free(arg->nonce, arg->arg);
free(arg);
return;
}
@@ -65,12 +67,13 @@ static void ack_resend(const struct timespec *timeout, void *argp) {
ffd_queue_put_delayed(&ack_requests, ack_resend, timeout, arg->interval, arg);
}
-void ffd_ack_request(void (*cb)(uint16_t nonce, void *arg), unsigned interval, unsigned retries, void *arg) {
+void ffd_ack_request(void (*cb)(uint16_t nonce, void *arg), void (*free_cb)(uint16_t nonce, void *arg), unsigned interval, unsigned retries, void *arg) {
UNSET_ACK(nonce);
cb(nonce, arg);
ack_arg_t *ack_arg = malloc(sizeof(ack_arg_t));
ack_arg->cb = cb;
+ ack_arg->free = free_cb;
ack_arg->arg = arg;
ack_arg->nonce = nonce++;
ack_arg->interval = interval;