Do not dereference a nullptr if there are too many files open

Former-commit-id: 4674eb29a261e8b046953398c94354fc3e550c2a
This commit is contained in:
John Sully 2021-10-21 23:45:46 +00:00
parent 3b788bac1e
commit 57feba97d2

View File

@ -3793,8 +3793,6 @@ static void initServerThread(struct redisServerThreadVars *pvar, int fMain)
pvar->in_eval = 0;
pvar->in_exec = 0;
pvar->el = aeCreateEventLoop(g_pserver->maxclients+CONFIG_FDSET_INCR);
aeSetBeforeSleepProc(pvar->el, beforeSleep, AE_SLEEP_THREADSAFE);
aeSetAfterSleepProc(pvar->el, afterSleep, AE_SLEEP_THREADSAFE);
pvar->current_client = nullptr;
pvar->fRetrySetAofEvent = false;
if (pvar->el == NULL) {
@ -3803,6 +3801,8 @@ static void initServerThread(struct redisServerThreadVars *pvar, int fMain)
strerror(errno));
exit(1);
}
aeSetBeforeSleepProc(pvar->el, beforeSleep, AE_SLEEP_THREADSAFE);
aeSetAfterSleepProc(pvar->el, afterSleep, AE_SLEEP_THREADSAFE);
fastlock_init(&pvar->lockPendingWrite, "lockPendingWrite");