do not discard received data during RecvWaitAll when the other side closes the socket cleanly

This commit is contained in:
Katharine Chui
2026-04-30 20:17:05 +02:00
parent 809080c9aa
commit 23760da53b
+2 -1
View File
@@ -82,7 +82,8 @@ int RecvWaitAll(int sockfd, char *buf, int len) {
while (offset < len) {
int recv_status = recv(sockfd, &buf[offset], len - offset, MSG_WAITALL);
if (recv_status == 0) {
return 0;
// do not discard received data when the other side closes the socket cleanly
return offset;
}
if (recv_status == -1) {
return -1;