diff --git a/asyncqueue.c b/asyncqueue.c index 99df7b50..90e86dce 100644 --- a/asyncqueue.c +++ b/asyncqueue.c @@ -132,6 +132,7 @@ static int AQ_Reconnect(pAsyncQueue self) static int CommandTimeout(void* cntx, int mode); +static int DelayedStart(void* cntx, int mode); static int StartCommand(pAsyncQueue self) { @@ -167,7 +168,7 @@ static int StartCommand(pAsyncQueue self) delay *= 1000; delay += (when.tv_usec - now.tv_usec + (1000 - 1)) / 1000; NetWatchRegisterTimer(&self->nw_tmr, delay, - CommandTimeout, self); + DelayedStart, self); return OKOK; } } @@ -288,6 +289,14 @@ static int CommandTimeout(void* cntx, int mode) return 1; } +static int DelayedStart(void* cntx, int mode) +{ + pAsyncQueue self = (pAsyncQueue) cntx; + self->nw_tmr = 0; + StartCommand(self); + return 1; +} + static int MyCallback(void* context, int mode) { pAsyncQueue self = (pAsyncQueue) context;