reuse timeout variable
This commit is contained in:
parent
52f138031f
commit
d59a39e0ab
|
@ -523,7 +523,7 @@ SIGAR_DECLARE(int) sigar_rpc_ping(char *host,
|
||||||
CLIENT *client;
|
CLIENT *client;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
int sock;
|
int sock;
|
||||||
struct timeval timeout, interval;
|
struct timeval timeout;
|
||||||
unsigned short port = 0;
|
unsigned short port = 0;
|
||||||
enum clnt_stat rpc_stat;
|
enum clnt_stat rpc_stat;
|
||||||
|
|
||||||
|
@ -532,15 +532,15 @@ SIGAR_DECLARE(int) sigar_rpc_ping(char *host,
|
||||||
return rpc_stat;
|
return rpc_stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
interval.tv_sec = 2;
|
timeout.tv_sec = 2;
|
||||||
interval.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
addr.sin_port = htons(port);
|
addr.sin_port = htons(port);
|
||||||
sock = RPC_ANYSOCK;
|
sock = RPC_ANYSOCK;
|
||||||
|
|
||||||
if (protocol == SIGAR_NETCONN_UDP) {
|
if (protocol == SIGAR_NETCONN_UDP) {
|
||||||
client =
|
client =
|
||||||
clntudp_create(&addr, program, version,
|
clntudp_create(&addr, program, version,
|
||||||
interval, &sock);
|
timeout, &sock);
|
||||||
}
|
}
|
||||||
else if (protocol == SIGAR_NETCONN_TCP) {
|
else if (protocol == SIGAR_NETCONN_TCP) {
|
||||||
client =
|
client =
|
||||||
|
|
Loading…
Reference in New Issue