Add ifdef to the SO_RCVTIMEO code
Not all platforms have a SO_RCVTIMEO socket option.
Этот коммит содержится в:
родитель
9b9dd03096
Коммит
b83791882d
@ -300,7 +300,9 @@ int
|
|||||||
iperf_udp_connect(struct iperf_test *test)
|
iperf_udp_connect(struct iperf_test *test)
|
||||||
{
|
{
|
||||||
int s, buf, sz;
|
int s, buf, sz;
|
||||||
|
#ifdef SO_RCVTIMEO
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Create and bind our local socket. */
|
/* Create and bind our local socket. */
|
||||||
if ((s = netdial(test->settings->domain, Pudp, test->bind_address, test->bind_port, test->server_hostname, test->server_port)) < 0) {
|
if ((s = netdial(test->settings->domain, Pudp, test->bind_address, test->bind_port, test->server_hostname, test->server_port)) < 0) {
|
||||||
@ -324,10 +326,12 @@ iperf_udp_connect(struct iperf_test *test)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SO_RCVTIMEO
|
||||||
/* 30 sec timeout for a case when there is a network problem. */
|
/* 30 sec timeout for a case when there is a network problem. */
|
||||||
tv.tv_sec = 30;
|
tv.tv_sec = 30;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval));
|
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a datagram to the UDP stream to let the server know we're here.
|
* Write a datagram to the UDP stream to let the server know we're here.
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user