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
| 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. */ |
| 1698 | void 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() */ |
| 1707 | void unprotectClient(client *c) { |
no test coverage detected