On Feb 21, 2014, at 6:35 PM, mtewoodbury@gmail.com wrote:
Note that this greatly improves network reliability.
How did you determine that? How could we confirm that?
- if ( (n = recvmsg(fd, &hdr, wsa->flags)) == -1 )
- n = recvmsg(fd, &hdr, wsa->flags);
- if (n == -1 && (errno == EINTR || errno == EAGAIN))
n = recvmsg(fd, &hdr, wsa->flags);
- if (n == -1)
return -1;
What's with that blank line between the last "if" and its corresponding statement?
- if (ret >= 0)
- {
- if (ret == -1 && (errno == EINTR || errno == EAGAIN))
ret = sendmsg(fd, &hdr, wsa->flags); /* Try it again quickly */
- if (ret >= 0) {
Why did you change the existing lines? You could have just added your two lines.
In general:
Is this actually the second patch of a two-patch series as indicated by the "[PATCH 2/2]" in the subject? I didn't receive the first patch.
Have you tested to see if just retrying on EINTR is sufficient to improve the reliability? EAGAIN is not typically a situation where an immediate retry helps.
The callers of WS2_recv() and WS2_send() already have tests for EINTR and EAGAIN. The strategy for dealing with those should probably exist in just one place. For my part, I think that all interruptible syscalls should be in a loop that immediately retries for EINTR, but EAGAIN should usually go back to some select(), poll(), kevent() or similar wait function.
-Ken