1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

socket: do not block in sendto()

This commit is contained in:
Steffen Vogel 2018-06-15 14:56:48 +02:00
parent 6042ee92af
commit 0c8e52da4e

View file

@ -437,11 +437,13 @@ retry: ret = io_sprint(&s->io, buf, buflen, &wbytes, smps, cnt);
case SOCKET_LAYER_UNIX: addrlen = SUN_LEN(&s->remote.sun); break;
}
bytes = sendto(s->sd, buf, wbytes, 0, (struct sockaddr *) &s->remote, addrlen);
bytes = sendto(s->sd, buf, wbytes, MSG_DONTWAIT, (struct sockaddr *) &s->remote, addrlen);
if (bytes < 0) {
if ((errno == EPERM) ||
(errno == ENOENT && s->layer == SOCKET_LAYER_UNIX))
warn("Failed send to node %s: %s", node_name(n), strerror(errno));
else if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
warn("socket: send would block");
else
serror("Failed send to node %s", node_name(n));
}