summaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2018-10-09 12:56:08 +0200
committerGitHub <noreply@github.com>2018-10-09 12:56:08 +0200
commit6660458a4c349bcca7a733003b47a7230553c58e (patch)
treed841c7cbab07888309a338e86564c67e27d88232 /src/debug.c
parentdb86dfb9856f0c507b286e2107b92cc04d6affa0 (diff)
parentfbef85ca5aca774c7533c6e0760edfd6258948c7 (diff)
downloadredis-6660458a4c349bcca7a733003b47a7230553c58e.tar.gz
Merge pull request #4804 from soloestoy/fix-debug-load
debug: avoid free client unexpectedly when reload & loadaof
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/debug.c b/src/debug.c
index a66390dbb..5a8190c96 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -345,7 +345,10 @@ NULL
return;
}
emptyDb(-1,EMPTYDB_NO_FLAGS,NULL);
- if (rdbLoad(server.rdb_filename,NULL) != C_OK) {
+ aeDeleteFileEvent(server.el,c->fd,AE_READABLE);
+ int ret = rdbLoad(server.rdb_filename,NULL);
+ aeCreateFileEvent(server.el,c->fd,AE_READABLE,readQueryFromClient,c);
+ if (ret != C_OK) {
addReplyError(c,"Error trying to load the RDB dump");
return;
}
@@ -354,7 +357,10 @@ NULL
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
if (server.aof_state != AOF_OFF) flushAppendOnlyFile(1);
emptyDb(-1,EMPTYDB_NO_FLAGS,NULL);
- if (loadAppendOnlyFile(server.aof_filename) != C_OK) {
+ aeDeleteFileEvent(server.el,c->fd,AE_READABLE);
+ int ret = loadAppendOnlyFile(server.aof_filename);
+ aeCreateFileEvent(server.el,c->fd,AE_READABLE,readQueryFromClient,c);
+ if (ret != C_OK) {
addReply(c,shared.err);
return;
}