Commit 02817460 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

netsync: don't sleep on poll() EINTR

parent 56cd0622
...@@ -180,7 +180,7 @@ static void *Master(void *handle) ...@@ -180,7 +180,7 @@ static void *Master(void *handle)
struct pollfd ufd = { .fd = sys->fd, .events = POLLIN, }; struct pollfd ufd = { .fd = sys->fd, .events = POLLIN, };
uint64_t data[2]; uint64_t data[2];
if (poll(&ufd, 1, -1) <= 0) if (poll(&ufd, 1, -1) < 0)
continue; continue;
/* We received something */ /* We received something */
...@@ -232,11 +232,8 @@ static void *Slave(void *handle) ...@@ -232,11 +232,8 @@ static void *Slave(void *handle)
goto wait; goto wait;
/* Don't block */ /* Don't block */
int ret = poll(&ufd, 1, sys->timeout); if (poll(&ufd, 1, sys->timeout) <= 0)
if (ret == 0)
continue; continue;
if (ret < 0)
goto wait;
const mtime_t receive_date = mdate(); const mtime_t receive_date = mdate();
if (recv(sys->fd, data, sizeof(data), 0) <= 0) if (recv(sys->fd, data, sizeof(data), 0) <= 0)
......
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