Try to read a little more

This commit is contained in:
angt
2016-02-03 19:49:42 +01:00
parent bfcfd3263e
commit 605b68dad5

6
mud.c
View File

@@ -396,6 +396,7 @@ int mud_pull (struct mud *mud)
struct sock *sock;
for (sock = mud->sock; sock; sock = sock->next) {
for (int i = 0; i < 16; i++) {
unsigned char next = mud->rx.end+1;
if (mud->rx.start == next)
@@ -409,8 +410,8 @@ int mud_pull (struct mud *mud)
ssize_t ret = recvfrom(sock->fd, packet->data, sizeof(packet->data),
0, (struct sockaddr *)&addr, &addrlen);
if (ret<=0)
continue;
if (ret <= 0)
break;
struct path *path = mud_new_path(mud, sock->fd, &addr, addrlen);
@@ -447,6 +448,7 @@ int mud_pull (struct mud *mud)
mud->rx.end = next;
}
}
return 0;
}