Disconnect a hiredis connection in the context of an instance link. */
| 1071 | |
| 1072 | /* Disconnect a hiredis connection in the context of an instance link. */ |
| 1073 | void instanceLinkCloseConnection(instanceLink *link, redisAsyncContext *c) { |
| 1074 | if (c == NULL) return; |
| 1075 | |
| 1076 | if (link->cc == c) { |
| 1077 | link->cc = NULL; |
| 1078 | link->pending_commands = 0; |
| 1079 | } |
| 1080 | if (link->pc == c) link->pc = NULL; |
| 1081 | c->data = NULL; |
| 1082 | link->disconnected = 1; |
| 1083 | redisAsyncFree(c); |
| 1084 | } |
| 1085 | |
| 1086 | /* Decrement the refcount of a link object, if it drops to zero, actually |
| 1087 | * free it and return NULL. Otherwise don't do anything and return the pointer |
no test coverage detected