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