diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2013-04-06 17:18:13 +0200 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2013-04-06 17:18:41 +0200 |
commit | 9474c4a9a5828291fc3c1157b8536031d3fa4cac (patch) | |
tree | 9d17f5a8fdeffbe7c0531f0f03c00b4e0ce6f62f | |
parent | 090b55c100be4364ac035b5a1b7440cf94e71904 (diff) |
tftpd.c: Follow up cleanup and restore of previous sockopt
-rw-r--r-- | tests/server/tftpd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 012e209e8..bfb7d58e2 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -1196,8 +1196,8 @@ static void sendtftp(struct testcase *test, struct formats *pf) */ static void recvtftp(struct testcase *test, struct formats *pf) { -#if USE_WINSOCK - DWORD recvtimeout; +#ifdef USE_WINSOCK + DWORD recvtimeout, recvtimeoutbak; #endif ssize_t n, size; recvblock = 0; @@ -1269,13 +1269,16 @@ send_ack: #endif /* normally times out and quits */ #ifdef USE_WINSOCK + recvtimeout = sizeof(recvtimeoutbak); + getsockopt(peer, SOL_SOCKET, SO_RCVTIMEO, + (char*)&recvtimeoutbak, (int*)&recvtimeout); 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; + recvtimeout = recvtimeoutbak; setsockopt(peer, SOL_SOCKET, SO_RCVTIMEO, (const char*)&recvtimeout, sizeof(recvtimeout)); #endif |