tftpd.c: Fixed sread timeout on Windows by setting it manually
This commit is contained in:
parent
34fa8d1e38
commit
a181e7b084
@ -1196,6 +1196,9 @@ static void sendtftp(struct testcase *test, struct formats *pf)
|
|||||||
*/
|
*/
|
||||||
static void recvtftp(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;
|
ssize_t n, size;
|
||||||
recvblock = 0;
|
recvblock = 0;
|
||||||
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
||||||
@ -1265,7 +1268,17 @@ send_ack:
|
|||||||
alarm(rexmtval);
|
alarm(rexmtval);
|
||||||
#endif
|
#endif
|
||||||
/* normally times out and quits */
|
/* 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));
|
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
|
#ifdef HAVE_ALARM
|
||||||
alarm(0);
|
alarm(0);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user