mirror of
https://github.com/firebase/nanopb
synced 2026-11-09 22:25:59 +05:45
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:
1 parent
1effc72370
commit
0101f7cdaa
1 file changed
+3
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user