mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 08:50:17 +00:00
deal-with-linux-EAGAIN-returns-when-receiving-20020731
sometimes you get EAGAIN from recvfrom, apparently if a packet comes in with a bad checksum for instance. we should deal better.
This commit is contained in:
parent
4d75219bed
commit
6c5439b809
@ -778,6 +778,8 @@ static SocketListener ()
|
|||||||
code = recvfrom(sock_kerb, packet.data, sizeof(packet.data), 0,
|
code = recvfrom(sock_kerb, packet.data, sizeof(packet.data), 0,
|
||||||
(struct sockaddr *) &packet.from, &fromLen);
|
(struct sockaddr *) &packet.from, &fromLen);
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
|
if (errno == EAGAIN || errno == ECONNREFUSED)
|
||||||
|
goto try_kerb5;
|
||||||
perror ("calling recvfrom");
|
perror ("calling recvfrom");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -792,10 +794,13 @@ static SocketListener ()
|
|||||||
packet.time = 0;
|
packet.time = 0;
|
||||||
process_udp_request (sock_kerb, &packet);
|
process_udp_request (sock_kerb, &packet);
|
||||||
}
|
}
|
||||||
|
try_kerb5:
|
||||||
if ((sock_kerb5 >= 0) && FD_ISSET(sock_kerb5, &rfds)) {
|
if ((sock_kerb5 >= 0) && FD_ISSET(sock_kerb5, &rfds)) {
|
||||||
code = recvfrom(sock_kerb5, packet.data, sizeof(packet.data), 0,
|
code = recvfrom(sock_kerb5, packet.data, sizeof(packet.data), 0,
|
||||||
(struct sockaddr *) &packet.from, &fromLen);
|
(struct sockaddr *) &packet.from, &fromLen);
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
|
if (errno == EAGAIN || errno == ECONNREFUSED)
|
||||||
|
continue;
|
||||||
perror ("calling recvfrom");
|
perror ("calling recvfrom");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -811,6 +816,15 @@ static SocketListener ()
|
|||||||
process_udp_request (sock_kerb5, &packet);
|
process_udp_request (sock_kerb5, &packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sock_kerb >= 0) {
|
||||||
|
close(sock_kerb);
|
||||||
|
sock_kerb = -1;
|
||||||
|
}
|
||||||
|
if (sock_kerb5 >= 0) {
|
||||||
|
close(sock_kerb5);
|
||||||
|
sock_kerb5 = -1;
|
||||||
|
}
|
||||||
|
printf("UDP SocketListener exiting due to error\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAIN
|
#if MAIN
|
||||||
|
@ -431,7 +431,9 @@ int rxi_Sendmsg(osi_socket socket, struct msghdr *msg_p, int flags)
|
|||||||
#elif defined(AFS_LINUX22_ENV)
|
#elif defined(AFS_LINUX22_ENV)
|
||||||
/* linux unfortunately returns ECONNREFUSED if the target port
|
/* linux unfortunately returns ECONNREFUSED if the target port
|
||||||
* is no longer in use */
|
* is no longer in use */
|
||||||
if (errno != EWOULDBLOCK && errno != ENOBUFS && errno != ECONNREFUSED)
|
/* and EAGAIN if a UDP checksum is incorrect */
|
||||||
|
if (errno != EWOULDBLOCK && errno != ENOBUFS &&
|
||||||
|
errno != ECONNREFUSED && errno != EAGAIN)
|
||||||
#else
|
#else
|
||||||
if (errno != EWOULDBLOCK && errno != ENOBUFS)
|
if (errno != EWOULDBLOCK && errno != ENOBUFS)
|
||||||
#endif
|
#endif
|
||||||
|
@ -403,7 +403,8 @@ rxi_Sendmsg(socket, msg_p, flags)
|
|||||||
#ifdef AFS_LINUX22_ENV
|
#ifdef AFS_LINUX22_ENV
|
||||||
/* linux unfortunately returns ECONNREFUSED if the target port
|
/* linux unfortunately returns ECONNREFUSED if the target port
|
||||||
* is no longer in use */
|
* is no longer in use */
|
||||||
if (ret == -1 && errno != ECONNREFUSED) {
|
/* and EAGAIN if a UDP checksum is incorrect */
|
||||||
|
if (ret == -1 && errno != ECONNREFUSED && errno != EAGAIN) {
|
||||||
#else
|
#else
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user