diff --git a/src/networking.cpp b/src/networking.cpp index 1c3e528c5..d843e8d99 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -258,20 +258,22 @@ int prepareClientToWrite(client *c) { serverAssert(GlobalLocksAcquired()); } - if (c->flags & CLIENT_FORCE_REPLY) return C_OK; // FORCE REPLY means we're doing something else with the buffer. + auto flags = c->flags.load(std::memory_order_relaxed); + + if (flags & CLIENT_FORCE_REPLY) return C_OK; // FORCE REPLY means we're doing something else with the buffer. // do not install a write handler /* If it's the Lua client we always return ok without installing any * handler since there is no socket at all. */ - if (c->flags & (CLIENT_LUA|CLIENT_MODULE)) return C_OK; + if (flags & (CLIENT_LUA|CLIENT_MODULE)) return C_OK; /* CLIENT REPLY OFF / SKIP handling: don't send replies. */ - if (c->flags & (CLIENT_REPLY_OFF|CLIENT_REPLY_SKIP)) return C_ERR; + if (flags & (CLIENT_REPLY_OFF|CLIENT_REPLY_SKIP)) return C_ERR; /* Masters don't receive replies, unless CLIENT_MASTER_FORCE_REPLY flag * is set. */ - if ((c->flags & CLIENT_MASTER) && - !(c->flags & CLIENT_MASTER_FORCE_REPLY)) return C_ERR; + if ((flags & CLIENT_MASTER) && + !(flags & CLIENT_MASTER_FORCE_REPLY)) return C_ERR; if (!c->conn) return C_ERR; /* Fake client for AOF loading. */