From: Sascha Schumann Date: Tue, 6 May 2003 14:39:31 +0000 (+0000) Subject: Eliminate fsync calls which apply to files, not sockets. X-Git-Tag: php-4.3.2RC3~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b790692180837840fb6653b3622431e23a697a93;p=php Eliminate fsync calls which apply to files, not sockets. 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 --- diff --git a/main/network.c b/main/network.c index ec83f9e101..7a78b68353 100644 --- a/main/network.c +++ b/main/network.c @@ -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,