aboutsummaryrefslogtreecommitdiff
path: root/tests/server/tftpd.c
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2013-04-06 14:39:56 +0200
committerMarc Hoersken <info@marc-hoersken.de>2013-04-06 14:39:56 +0200
commita181e7b084b67112084d6cbce166a1ac1ffaecd4 (patch)
treee34c08b4c9fe7da778e5d124420f7ec72a00dcf8 /tests/server/tftpd.c
parent34fa8d1e38b1465839c43bb6e676816d190ae796 (diff)
tftpd.c: Fixed sread timeout on Windows by setting it manually
Diffstat (limited to 'tests/server/tftpd.c')
-rw-r--r--tests/server/tftpd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index 48950c549..012e209e8 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -1196,6 +1196,9 @@ static void sendtftp(struct testcase *test, struct formats *pf)
*/
static void recvtftp(struct testcase *test, struct formats *pf)
{
+#if USE_WINSOCK
+ DWORD recvtimeout;
+#endif
ssize_t n, size;
recvblock = 0;
#if defined(HAVE_ALARM) && defined(SIGALRM)
@@ -1265,7 +1268,17 @@ send_ack:
alarm(rexmtval);
#endif
/* normally times out and quits */
+#ifdef USE_WINSOCK
+ recvtimeout = 10;
+ setsockopt(peer, SOL_SOCKET, SO_RCVTIMEO,
+ (const char*)&recvtimeout, sizeof(recvtimeout));
+#endif
n = sread(peer, &buf.storage[0], sizeof(buf.storage));
+#ifdef USE_WINSOCK
+ recvtimeout = 0;
+ setsockopt(peer, SOL_SOCKET, SO_RCVTIMEO,
+ (const char*)&recvtimeout, sizeof(recvtimeout));
+#endif
#ifdef HAVE_ALARM
alarm(0);
#endif