Retain the same semantics for connection error on connection timeout
This ensures that a disconnect occurs. This commit also ensures that disconnects will clean the socket even if the user is in no-auto-free mode
This commit is contained in:
parent
297de989a6
commit
17b4174089
11
async.c
11
async.c
@ -60,6 +60,7 @@
|
|||||||
} while(0)
|
} while(0)
|
||||||
#define _EL_CLEANUP(ctx) do { \
|
#define _EL_CLEANUP(ctx) do { \
|
||||||
if ((ctx)->ev.cleanup) (ctx)->ev.cleanup((ctx)->ev.data); \
|
if ((ctx)->ev.cleanup) (ctx)->ev.cleanup((ctx)->ev.data); \
|
||||||
|
ctx->ev.cleanup = NULL; \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
static void refreshTimeout(redisAsyncContext *ctx) {
|
static void refreshTimeout(redisAsyncContext *ctx) {
|
||||||
@ -359,6 +360,10 @@ static void __redisAsyncDisconnect(redisAsyncContext *ac) {
|
|||||||
c->flags |= REDIS_DISCONNECTING;
|
c->flags |= REDIS_DISCONNECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* cleanup event library on disconnect.
|
||||||
|
* this is safe to call multiple times */
|
||||||
|
_EL_CLEANUP(ac);
|
||||||
|
|
||||||
/* For non-clean disconnects, __redisAsyncFree() will execute pending
|
/* For non-clean disconnects, __redisAsyncFree() will execute pending
|
||||||
* callbacks with a NULL-reply. */
|
* callbacks with a NULL-reply. */
|
||||||
if (!(c->flags & REDIS_NO_AUTO_FREE)) {
|
if (!(c->flags & REDIS_NO_AUTO_FREE)) {
|
||||||
@ -697,6 +702,12 @@ void redisAsyncHandleTimeout(redisAsyncContext *ac) {
|
|||||||
while (__redisShiftCallback(&ac->replies, &cb) == REDIS_OK) {
|
while (__redisShiftCallback(&ac->replies, &cb) == REDIS_OK) {
|
||||||
__redisRunCallback(ac, &cb, NULL);
|
__redisRunCallback(ac, &cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Don't automatically sever the connection,
|
||||||
|
* rather, allow to ignore <x> responses before the queue is clear
|
||||||
|
*/
|
||||||
|
__redisAsyncDisconnect(ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets a pointer to the first argument and its length starting at p. Returns
|
/* Sets a pointer to the first argument and its length starting at p. Returns
|
||||||
|
Loading…
Reference in New Issue
Block a user