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
| 2170 | * 2) Moreover it makes sure that if the client is freed in a different code |
| 2171 | * path, it is not really released, but only marked for later release. */ |
| 2172 | void protectClient(client *c) { |
| 2173 | c->flags |= CLIENT_PROTECTED; |
| 2174 | AssertCorrectThread(c); |
| 2175 | if (c->conn) { |
| 2176 | connSetReadHandler(c->conn,NULL); |
| 2177 | connSetWriteHandler(c->conn,NULL); |
| 2178 | } |
| 2179 | } |
| 2180 | |
| 2181 | /* This will undo the client protection done by protectClient() */ |
| 2182 | void unprotectClient(client *c) { |
no test coverage detected