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. */
| 2301 | * consumed by write(). We don't try to optimize this for speed too much |
| 2302 | * as this is a very low traffic channel. */ |
| 2303 | void clusterWriteHandler(connection *conn) { |
| 2304 | serverAssert(ielFromEventLoop(serverTL->el) == IDX_EVENT_LOOP_MAIN); |
| 2305 | clusterLink *link = (clusterLink*)connGetPrivateData(conn); |
| 2306 | ssize_t nwritten; |
| 2307 | |
| 2308 | nwritten = connWrite(conn, link->sndbuf, sdslen(link->sndbuf)); |
| 2309 | if (nwritten <= 0) { |
| 2310 | serverLog(LL_DEBUG,"I/O error writing to node link: %s", |
| 2311 | (nwritten == -1) ? connGetLastError(conn) : "short write"); |
| 2312 | handleLinkIOError(link); |
| 2313 | return; |
| 2314 | } |
| 2315 | sdsrange(link->sndbuf,nwritten,-1); |
| 2316 | if (sdslen(link->sndbuf) == 0) |
| 2317 | connSetWriteHandler(link->conn, NULL); |
| 2318 | } |
| 2319 | |
| 2320 | /* A connect handler that gets called when a connection to another node |
| 2321 | * gets established. |
nothing calls this directly
no test coverage detected