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

Function clusterWriteHandler

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

Send data. This is handled using a trivial send buffer that gets * consumed by write(). We don't try to optimize this for speed too much * as this is a very low traffic channel. */

Source from the content-addressed store, hash-verified

2254 * consumed by write(). We don't try to optimize this for speed too much
2255 * as this is a very low traffic channel. */
2256void clusterWriteHandler(connection *conn) {
2257 clusterLink *link = connGetPrivateData(conn);
2258 ssize_t nwritten;
2259
2260 nwritten = connWrite(conn, link->sndbuf, sdslen(link->sndbuf));
2261 if (nwritten <= 0) {
2262 serverLog(LL_DEBUG,"I/O error writing to node link: %s",
2263 (nwritten == -1) ? connGetLastError(conn) : "short write");
2264 handleLinkIOError(link);
2265 return;
2266 }
2267 sdsrange(link->sndbuf,nwritten,-1);
2268 if (sdslen(link->sndbuf) == 0)
2269 connSetWriteHandler(link->conn, NULL);
2270}
2271
2272/* A connect handler that gets called when a connection to another node
2273 * gets established.

Callers

nothing calls this directly

Calls 7

connGetPrivateDataFunction · 0.85
connWriteFunction · 0.85
sdslenFunction · 0.85
connGetLastErrorFunction · 0.85
handleLinkIOErrorFunction · 0.85
sdsrangeFunction · 0.85
connSetWriteHandlerFunction · 0.85

Tested by

no test coverage detected