mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8287404: Improve ping times
Reviewed-by: alanb, dfuchs, rhalade
This commit is contained in:
parent
1b5d35ad2c
commit
c06135b5a6
2 changed files with 4 additions and 4 deletions
|
@ -346,8 +346,8 @@ ping4(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif,
|
||||||
struct ip *ip;
|
struct ip *ip;
|
||||||
struct sockaddr_in sa_recv;
|
struct sockaddr_in sa_recv;
|
||||||
jchar pid;
|
jchar pid;
|
||||||
struct timeval tv;
|
struct timeval tv = { 0, 0 };
|
||||||
size_t plen = ICMP_ADVLENMIN + sizeof(tv);
|
const size_t plen = ICMP_MINLEN + sizeof(tv);
|
||||||
|
|
||||||
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
|
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ ping4(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif,
|
||||||
ip = (struct ip *)recvbuf;
|
ip = (struct ip *)recvbuf;
|
||||||
hlen = ((jint)(unsigned int)(ip->ip_hl)) << 2;
|
hlen = ((jint)(unsigned int)(ip->ip_hl)) << 2;
|
||||||
// check if we received enough data
|
// check if we received enough data
|
||||||
if (n < (jint)(hlen + sizeof(struct icmp))) {
|
if (n < (jint)(hlen + plen)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
icmp = (struct icmp *)(recvbuf + hlen);
|
icmp = (struct icmp *)(recvbuf + hlen);
|
||||||
|
|
|
@ -545,7 +545,7 @@ ping6(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif,
|
||||||
struct icmp6_hdr *icmp6;
|
struct icmp6_hdr *icmp6;
|
||||||
struct sockaddr_in6 sa_recv;
|
struct sockaddr_in6 sa_recv;
|
||||||
jchar pid;
|
jchar pid;
|
||||||
struct timeval tv;
|
struct timeval tv = { 0, 0 };
|
||||||
size_t plen = sizeof(struct icmp6_hdr) + sizeof(tv);
|
size_t plen = sizeof(struct icmp6_hdr) + sizeof(tv);
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue