MCPcopy Create free account
hub / github.com/F-Stack/f-stack / protectClient

Function protectClient

app/redis-6.2.6/src/networking.c:1698–1704  ·  view source on GitHub ↗

This function is used when we want to re-enter the event loop but there * is the risk that the client we are dealing with will be freed in some * way. This happens for instance in: * * * DEBUG RELOAD and similar. * * When a Lua script is in -BUSY state. * * So the function will protect the client by doing two things: * * 1) It removes the file events. This way it is not possible that an

Source from the content-addressed store, hash-verified

1696 * 2) Moreover it makes sure that if the client is freed in a different code
1697 * path, it is not really released, but only marked for later release. */
1698void protectClient(client *c) {
1699 c->flags |= CLIENT_PROTECTED;
1700 if (c->conn) {
1701 connSetReadHandler(c->conn,NULL);
1702 connSetWriteHandler(c->conn,NULL);
1703 }
1704}
1705
1706/* This will undo the client protection done by protectClient() */
1707void unprotectClient(client *c) {

Callers 2

luaMaskCountHookFunction · 0.85
debugCommandFunction · 0.85

Calls 2

connSetReadHandlerFunction · 0.85
connSetWriteHandlerFunction · 0.85

Tested by

no test coverage detected