network_server example: Detect count=0 in read_callback() (#421)

Previously the example code would falsely detect EOF condition if
called with count = 0.
This commit is contained in:
Petteri Aimonen committed 2019-08-27 14:47:14 +03:00
1 parent 1effc72370
commit 0101f7cdaa
1 file changed
+3
+3
View File
@@ -19,6 +19,9 @@ static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count)
int fd = (intptr_t)stream->state;
int result;
if (count == 0)
return true;
result = recv(fd, buf, count, MSG_WAITALL);
if (result == 0)