Ensure our connections are touched only on the right thread

Former-commit-id: e8a44821d016e9f9b8ca873757d4786c4c271b7c
This commit is contained in:
John Sully 2021-05-30 02:08:30 +00:00
parent 1a734223ca
commit 42f5d1a175

View File

@ -688,6 +688,7 @@ void freeClusterLink(clusterLink *link) {
} }
static void clusterConnAcceptHandler(connection *conn) { static void clusterConnAcceptHandler(connection *conn) {
serverAssert(ielFromEventLoop(serverTL->el) == IDX_EVENT_LOOP_MAIN);
clusterLink *link; clusterLink *link;
if (connGetState(conn) != CONN_STATE_CONNECTED) { if (connGetState(conn) != CONN_STATE_CONNECTED) {
@ -1791,6 +1792,8 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc
* processing lead to some inconsistency error (for instance a PONG * processing lead to some inconsistency error (for instance a PONG
* received from the wrong sender ID). */ * received from the wrong sender ID). */
int clusterProcessPacket(clusterLink *link) { int clusterProcessPacket(clusterLink *link) {
serverAssert(ielFromEventLoop(serverTL->el) == IDX_EVENT_LOOP_MAIN);
clusterMsg *hdr = (clusterMsg*) link->rcvbuf; clusterMsg *hdr = (clusterMsg*) link->rcvbuf;
uint32_t totlen = ntohl(hdr->totlen); uint32_t totlen = ntohl(hdr->totlen);
uint16_t type = ntohs(hdr->type); uint16_t type = ntohs(hdr->type);
@ -3546,6 +3549,7 @@ void clusterHandleManualFailover(void) {
/* This is executed 10 times every second */ /* This is executed 10 times every second */
void clusterCron(void) { void clusterCron(void) {
serverAssert(ielFromEventLoop(serverTL->el) == IDX_EVENT_LOOP_MAIN);
dictIterator *di; dictIterator *di;
dictEntry *de; dictEntry *de;
int update_state = 0; int update_state = 0;