Add some TODO messages and change the reconnect backoff limits
This commit is contained in:
21
asyncqueue.c
21
asyncqueue.c
@@ -144,6 +144,9 @@ static int TimedReconnect(void *cntx, int mode)
|
|||||||
if (self->state != eAsyncConnected)
|
if (self->state != eAsyncConnected)
|
||||||
SICSLogPrintf(eStatus, "Function: %s:%s\n", self->queue_name,
|
SICSLogPrintf(eStatus, "Function: %s:%s\n", self->queue_name,
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
|
/* TODO: if self->pSock is NULL we haven't connected yet */
|
||||||
|
|
||||||
iRet = NETReconnect(self->pSock);
|
iRet = NETReconnect(self->pSock);
|
||||||
/*
|
/*
|
||||||
* iRet can take the following values:
|
* iRet can take the following values:
|
||||||
@@ -158,10 +161,10 @@ static int TimedReconnect(void *cntx, int mode)
|
|||||||
NetWatchSetMode(self->nw_ctx, 0);
|
NetWatchSetMode(self->nw_ctx, 0);
|
||||||
/* implement an exponential backoff within limits */
|
/* implement an exponential backoff within limits */
|
||||||
self->retryTimer = 2 * self->retryTimer;
|
self->retryTimer = 2 * self->retryTimer;
|
||||||
if (self->retryTimer < 250)
|
if (self->retryTimer < 125)
|
||||||
self->retryTimer = 250;
|
self->retryTimer = 125;
|
||||||
if (self->retryTimer > 30000)
|
if (self->retryTimer > 16000)
|
||||||
self->retryTimer = 30000;
|
self->retryTimer = 16000;
|
||||||
NetWatchRegisterTimer(&self->nw_tmr, self->retryTimer, TimedReconnect,
|
NetWatchRegisterTimer(&self->nw_tmr, self->retryTimer, TimedReconnect,
|
||||||
self);
|
self);
|
||||||
SICSLogPrintf(eStatus, "In %s:%s: state %s => eAsyncWaiting\n",
|
SICSLogPrintf(eStatus, "In %s:%s: state %s => eAsyncWaiting\n",
|
||||||
@@ -982,6 +985,7 @@ static pAsyncQueue AQ_Create(const char *host, const char *port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self == NULL) {
|
if (self == NULL) {
|
||||||
|
/* TODO: if channel (self->pSock) is NULL we haven't connected yet, do it later */
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -1001,6 +1005,15 @@ static pAsyncQueue AQ_Create(const char *host, const char *port)
|
|||||||
if (i == queue_index)
|
if (i == queue_index)
|
||||||
queue_array[queue_index++] = self;
|
queue_array[queue_index++] = self;
|
||||||
|
|
||||||
|
/* TODO: if self->pSock is NULL we haven't connected yet */
|
||||||
|
#if 0
|
||||||
|
if (channel == NULL) {
|
||||||
|
/* TODO: all the rest */
|
||||||
|
NetWatchRegisterTimer(&self->nw_tmr, self->retryTimer, TimedReconnect,
|
||||||
|
self);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user