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. */
| 2254 | * consumed by write(). We don't try to optimize this for speed too much |
| 2255 | * as this is a very low traffic channel. */ |
| 2256 | void 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. |
nothing calls this directly
no test coverage detected