]> granicus.if.org Git - php/commitdiff
Eliminate fsync calls which apply to files, not sockets.
authorSascha Schumann <sas@php.net>
Tue, 6 May 2003 14:39:31 +0000 (14:39 +0000)
committerSascha Schumann <sas@php.net>
Tue, 6 May 2003 14:39:31 +0000 (14:39 +0000)
Also disable the Win32 socket shutdown procedure for non-Win32 systems.

closesocket has quite different semantics on Win32 which requires
a certain shutdown procedure as outlined here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/shutdown_2.asp

main/network.c

index ec83f9e10110063fb870ab1f6431e1ed00d9a1e5..7a78b6835313bd840381225eb3bf943df476c509 100644 (file)
@@ -1031,6 +1031,7 @@ static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC)
                }
 #endif
 
+#ifdef PHP_WIN32
                /* prevent more data from coming in */
                shutdown(sock->socket, SHUT_RD);
 
@@ -1050,6 +1051,7 @@ static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC)
                
                        n = select(sock->socket + 1, NULL, &wrfds, &efds, &timeout);
                } while (n == -1 && php_socket_errno() == EINTR);
+#endif
                
                closesocket(sock->socket);
 
@@ -1060,12 +1062,6 @@ static int php_sockop_close(php_stream *stream, int close_handle TSRMLS_DC)
        return 0;
 }
 
-static int php_sockop_flush(php_stream *stream TSRMLS_DC)
-{
-       php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
-       return fsync(sock->socket);
-}
-
 static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC)
 {
        php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
@@ -1136,7 +1132,7 @@ static int php_sockop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
 
 php_stream_ops php_stream_socket_ops = {
        php_sockop_write, php_sockop_read,
-       php_sockop_close, php_sockop_flush,
+       php_sockop_close, NULL,
        "socket",
        NULL, /* seek */
        php_sockop_cast,