Free a cluster link, but does not free the associated node of course. * This function will just make sure that the original node associated * with this link will have the 'link' field set to NULL. */
| 664 | * This function will just make sure that the original node associated |
| 665 | * with this link will have the 'link' field set to NULL. */ |
| 666 | void freeClusterLink(clusterLink *link) { |
| 667 | if (ielFromEventLoop(serverTL->el) != IDX_EVENT_LOOP_MAIN) |
| 668 | { |
| 669 | // we can't perform this operation on this thread, queue it on the main thread |
| 670 | if (link->node) |
| 671 | link->node->link = NULL; |
| 672 | link->node = nullptr; |
| 673 | int res = aePostFunction(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, [link]{ |
| 674 | freeClusterLink(link); |
| 675 | }); |
| 676 | serverAssert(res == AE_OK); |
| 677 | return; |
| 678 | } |
| 679 | if (link->conn) { |
| 680 | connClose(link->conn); |
| 681 | link->conn = NULL; |
| 682 | } |
| 683 | sdsfree(link->sndbuf); |
| 684 | zfree(link->rcvbuf); |
| 685 | if (link->node) |
| 686 | link->node->link = NULL; |
| 687 | zfree(link); |
| 688 | } |
| 689 | |
| 690 | static void clusterConnAcceptHandler(connection *conn) { |
| 691 | serverAssert(ielFromEventLoop(serverTL->el) == IDX_EVENT_LOOP_MAIN); |
no test coverage detected