Remove while(1)

This commit is contained in:
Adrien Gallouët
2017-01-19 12:47:06 +00:00
parent 0664fc3b21
commit 9cebabfe01

View File

@@ -439,15 +439,20 @@ main(int argc, char **argv)
} }
if (FD_ISSET(mud_fd, &rfds)) { if (FD_ISSET(mud_fd, &rfds)) {
while (1) { size_t size = 0;
const int size = mud_recv(mud, buf, sizeof(buf));
if (size <= 0) { while (sizeof(buf) - size >= gt.mtu) {
if (size == -1 && errno != EAGAIN) const int r = mud_recv(mud, &buf[size], sizeof(buf) - size);
if (r <= 0) {
if (r == -1 && errno != EAGAIN)
perror("mud_recv"); perror("mud_recv");
break; break;
} }
size += r;
}
int p = 0; int p = 0;
while (p < size) { while (p < size) {
@@ -463,7 +468,6 @@ main(int argc, char **argv)
} }
} }
} }
}
return 0; return 0;
} }