From 647c144d82f3798656cffd8089fb3a507aa672da Mon Sep 17 00:00:00 2001 From: Ryan McCabe Date: Tue, 23 May 2017 15:37:42 -0400 Subject: [PATCH] Retry writes in the TCP, mcast, and serial listener plugins while sending a response to clients, if the write fails or is incomplete. Signed-off-by: Ryan McCabe --- server/mcast.c | 2 +- server/serial.c | 3 +-- server/tcp.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/server/mcast.c b/server/mcast.c index 56fa258..f6181aa 100644 --- a/server/mcast.c +++ b/server/mcast.c @@ -316,7 +316,7 @@ do_fence_request_tcp(fence_req_t *req, mcast_info *info) } dbg_printf(3, "Sending response to caller...\n"); - if (write(fd, &response, 1) < 0) { + if (_write_retry(fd, &response, 1, NULL) < 0) { perror("write"); } diff --git a/server/serial.c b/server/serial.c index 5803e6c..558292a 100644 --- a/server/serial.c +++ b/server/serial.c @@ -239,9 +239,8 @@ do_fence_request(int fd, const char *src, serial_req_t *req, serial_info *info) swab_serial_resp_t(&resp); dbg_printf(3, "Sending response to caller...\n"); - if (write(fd, &resp, sizeof(resp)) < 0) { + if (_write_retry(fd, &resp, sizeof(resp), NULL) < 0) perror("write"); - } /* XVM shotguns multicast packets, so we want to avoid * acting on the same request multiple times if the first diff --git a/server/tcp.c b/server/tcp.c index a6186c6..fc9caca 100644 --- a/server/tcp.c +++ b/server/tcp.c @@ -239,7 +239,7 @@ do_fence_request_tcp(int fd, fence_req_t *req, tcp_info *info) } dbg_printf(3, "Sending response to caller...\n"); - if (write(fd, &response, 1) < 0) { + if (_write_retry(fd, &response, 1, NULL) < 0) { perror("write"); }