Commit f944e018 by Juliusz Chroboczek

Handle EINTR and EAGAIN in babel_send.

1 parent 04699653
Showing 1 changed file with 15 additions and 0 deletions
......@@ -28,6 +28,8 @@ THE SOFTWARE.
#include <netinet/in.h>
#include <errno.h>
#include "babel.h"
#include "util.h"
#include "net.h"
int
......@@ -126,6 +128,19 @@ babel_send(int s,
msg.msg_namelen = slen;
msg.msg_iov = iovec;
msg.msg_iovlen = 2;
again:
rc = sendmsg(s, &msg, 0);
if(rc < 0) {
if(errno == EINTR)
goto again;
else if(errno == EAGAIN) {
int rc2;
rc2 = wait_for_fd(1, s, 5);
if(rc2 > 0)
goto again;
errno = EAGAIN;
}
}
return rc;
}
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!