Commit f944e018 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Handle EINTR and EAGAIN in babel_send.

parent 04699653
......@@ -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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment