src/server/util/netbuf.c

changeset 385
a1f4cb076d2f
parent 330
71b652743871
child 540
d9c3c23c635b
--- a/src/server/util/netbuf.c	Tue Aug 13 22:14:32 2019 +0200
+++ b/src/server/util/netbuf.c	Sat Sep 24 16:26:10 2022 +0200
@@ -141,9 +141,15 @@
 
             buf->pos += bytes_in_buffer;
             return bytes_in_buffer;
+        } else if(buf->pos >= buf->maxsize) {
+            return NETBUF_EOF;
         }
     }
-
+    
+    if(!buf->sd) {
+        return NETBUF_EOF;
+    }
+    
     /* The netbuf is empty.  Read data directly into the caller's buffer */
     bytes = net_read(buf->sd, buffer, size);
     if (bytes == 0)

mercurial