CVS update: php3/functions
| From: | sas | Date: | Sun, 20 Jun 1999 10:28:06 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-7192@lists.php.net to get a copy of this message | ||
Date: Sunday June 20, 1999 @ 6:28
Author: sas
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv19094/functions
Modified Files:
fsock.c
Log Message:
add some comments
Index: php3/functions/fsock.c
diff -u php3/functions/fsock.c:1.122 php3/functions/fsock.c:1.123
--- php3/functions/fsock.c:1.122 Fri Jun 18 12:18:21 1999
+++ php3/functions/fsock.c Sun Jun 20 06:28:06 1999
@@ -27,7 +27,7 @@
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.c,v 1.122 1999/06/18 16:18:21 sas Exp $ */
+/* $Id: fsock.c,v 1.123 1999/06/20 10:28:06 sas Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -512,13 +512,25 @@
int nr_bytes;
size_t nr_read = 0;
+ /* we want to avoid system calls - therefore we check,
+ whether we already have enough data in the buffer
+ or if eof is already set */
+
if(sock->eof || TOREAD(sock) >= maxread)
return 0;
+ /* For blocking sockets, we wait until there is some
+ data to read (real data or EOF)
+
+ Otherwise, recv() may time out and return 0 and
+ therefore sock->eof would be set errornously.
+ */
+
if(sock->is_blocked) {
_php3_sock_wait_for_data(sock);
}
+ /* read at a maximum sock->chunk_size */
nr_bytes = recv(sock->socket, buf, sock->chunk_size, 0);
if(nr_bytes > 0) {
if(sock->writepos + nr_bytes > sock->readbuflen) {