mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 16:48:27 -05:00
debug: avoid free client unexpectedly when reload & loadaof
This commit is contained in:
parent
e08d6bb37e
commit
fbef85ca5a
10
src/debug.c
10
src/debug.c
@ -340,7 +340,10 @@ NULL
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emptyDb(-1,EMPTYDB_NO_FLAGS,NULL);
|
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");
|
addReplyError(c,"Error trying to load the RDB dump");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -349,7 +352,10 @@ NULL
|
|||||||
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
|
||||||
if (server.aof_state == AOF_ON) flushAppendOnlyFile(1);
|
if (server.aof_state == AOF_ON) flushAppendOnlyFile(1);
|
||||||
emptyDb(-1,EMPTYDB_NO_FLAGS,NULL);
|
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);
|
addReply(c,shared.err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user