MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterSendMessage

Function clusterSendMessage

app/redis-6.2.6/src/cluster.c:2397–2408  ·  view source on GitHub ↗

Put stuff into the send buffer. * * It is guaranteed that this function will never have as a side effect * the link to be invalidated, so it is safe to call this function * from event handlers that will do stuff with the same link later. */

Source from the content-addressed store, hash-verified

2395 * the link to be invalidated, so it is safe to call this function
2396 * from event handlers that will do stuff with the same link later. */
2397void clusterSendMessage(clusterLink *link, unsigned char *msg, size_t msglen) {
2398 if (sdslen(link->sndbuf) == 0 && msglen != 0)
2399 connSetWriteHandlerWithBarrier(link->conn, clusterWriteHandler, 1);
2400
2401 link->sndbuf = sdscatlen(link->sndbuf, msg, msglen);
2402
2403 /* Populate sent messages stats. */
2404 clusterMsg *hdr = (clusterMsg*) msg;
2405 uint16_t type = ntohs(hdr->type);
2406 if (type < CLUSTERMSG_TYPE_COUNT)
2407 server.cluster->stats_bus_messages_sent[type]++;
2408}
2409
2410/* Send a message to all the nodes that are part of the cluster having
2411 * a connected link.

Callers 7

clusterBroadcastMessageFunction · 0.85
clusterSendPingFunction · 0.85
clusterSendPublishFunction · 0.85
clusterSendUpdateFunction · 0.85
clusterSendModuleFunction · 0.85
clusterSendFailoverAuthFunction · 0.85
clusterSendMFStartFunction · 0.85

Calls 3

sdslenFunction · 0.85
sdscatlenFunction · 0.85

Tested by

no test coverage detected