|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-02-19 17:11 UTC] tem at iocus dot com
The php_read function does not seem to handle non-blocking sockets correctly. The read function will return a negative value when EAGAIN (no data available when in nonblocking mode) error occurs. (from the man page:
On error, -1 is returned, and errno is set appropriately.) Here is my quick n' dirty patch:
--- ext/sockets/mysocket.c Mon Feb 19 16:53:20 2001
+++ ext/sockets/sockets.c Mon Feb 19 16:52:42 2001
@@ -635,7 +635,7 @@
if (m > 0) {
t++;
n++;
- } else if (m <= 0) {
+ } else if (m == 0) {
no_read++;
if (nonblock && no_read >= 2) {
return n; /* The first pass, m always is 0, so no_read becomes 1
enjoy.
-tem
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 11:00:02 2025 UTC |
err did the patch backwards. --- ext/sockets/sockets.c Mon Feb 19 16:52:42 2001 +++ ext/sockets/mysocket.c Mon Feb 19 16:53:20 2001 @@ -635,7 +635,7 @@ if (m > 0) { t++; n++; - } else if (m == 0) { + } else if (m <= 0) { no_read++; if (nonblock && no_read >= 2) { return n; /* The first pass, m always is 0, so no_read becomes 1