Merge pull request #45 from mutability/net-client-eof-handling

Detect client EOF properly. Handle EWOULDBLOCK.
This commit is contained in:
MalcolmRobb 2014-10-02 21:32:40 +01:00
commit 65751ed6e9

View file

@ -858,11 +858,12 @@ void modesReadFromClient(struct client *c, char *sep,
bContinue = 0; bContinue = 0;
} }
#ifndef _WIN32 #ifndef _WIN32
if ( (nread < 0) && (errno != EAGAIN)) { // Error, or end of file if ( (nread < 0 && errno != EAGAIN && errno != EWOULDBLOCK) || nread == 0 ) { // Error, or end of file
#else #else
if ( (nread < 0) && (errno != EWOULDBLOCK)) { // Error, or end of file if ( (nread < 0) && (errno != EWOULDBLOCK)) { // Error, or end of file
#endif #endif
modesFreeClient(c); modesFreeClient(c);
return;
} }
if (nread <= 0) { if (nread <= 0) {
break; // Serve next client break; // Serve next client