[hamradio-commits] [dump1090] 341/373: Detect client EOF properly. Handle EWOULDBLOCK.

Matthew Ernisse mernisse-guest at moszumanska.debian.org
Thu Oct 23 14:58:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

mernisse-guest pushed a commit to branch backport
in repository dump1090.

commit a513c3677ba72faff5bf32afb56b1f879678fc2f
Author: Oliver Jowett <oliver at mutability.co.uk>
Date:   Wed Oct 1 12:29:16 2014 +0100

    Detect client EOF properly. Handle EWOULDBLOCK.
    
    Client disconnection appears as a read of 0 bytes.
    Without a test for this, dump1090 continues to poll that client forever.
    
    Also, read() may return EWOULDBLOCK as well as EAGAIN
    for "no data right now", so handle that.
    
    I don't know if there is an equivalent Win32 bug here as the Win32
    interfaces seem subtly different to vanilla POSIX.
    
    The following test/break can probably be removed if Win32 needs
    the same fix.
---
 net_io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net_io.c b/net_io.c
index 2b0ed9a..0283394 100644
--- a/net_io.c
+++ b/net_io.c
@@ -851,11 +851,12 @@ void modesReadFromClient(struct client *c, char *sep,
             bContinue = 0;
         }
 #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
         if ( (nread < 0) && (errno != EWOULDBLOCK)) { // Error, or end of file
 #endif
             modesFreeClient(c);
+            return;
         }
         if (nread <= 0) {
             break; // Serve next client

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git



More information about the pkg-hamradio-commits mailing list