summaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-01-08 17:50:07 +0100
committerDaniel Stenberg <daniel@haxx.se>2017-01-09 23:43:15 +0100
commit62e67c77722d3bb936201a813fa318c4304db794 (patch)
tree5633015b9f4d0da56ecffe5c818ce1018cd9a115 /tests/server
parentd3a313c099e313bc9e4199499208330b39c72462 (diff)
downloadcurl-62e67c77722d3bb936201a813fa318c4304db794.tar.gz
sws: retry send() on EWOULDBLOCK
Fixes spurious test 1060 and 1061 failures on OpenBSD, Solaris and more. Bug: https://curl.haxx.se/mail/lib-2017-01/0009.html Reported-by: Christian Weisgerber
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/sws.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index c4125a0a8..63e9fdf5c 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1200,14 +1200,21 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
size_t num = count;
if(num > 200)
num = 200;
+
+ retry:
written = swrite(sock, buffer, num);
if(written < 0) {
+ if((EWOULDBLOCK == errno) || (EAGAIN == errno)) {
+ wait_ms(10);
+ goto retry;
+ }
sendfailure = TRUE;
break;
}
else {
logmsg("Sent off %zd bytes", written);
}
+
/* write to file as well */
fwrite(buffer, 1, (size_t)written, dump);