php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #51879
Patch add-tcp-nodelay revision 2011-02-17 20:45 UTC by seld@php.net
revision 2011-02-17 20:27 UTC by seld@php.net
revision 2011-02-17 19:08 UTC by seld@php.net
revision 2011-02-17 18:44 UTC by seld@php.net

Patch add-tcp-nodelay for Streams related Bug #51879

Patch version 2011-02-17 20:45 UTC

Return to Bug #51879 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: seld@php.net

Index: ext/standard/file.c
===================================================================
--- ext/standard/file.c	(revision 308439)
+++ ext/standard/file.c	(working copy)
@@ -217,6 +217,7 @@
 	REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT",		PHP_STREAM_CLIENT_PERSISTENT,		CONST_CS | CONST_PERSISTENT);
 	REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT",	PHP_STREAM_CLIENT_ASYNC_CONNECT,	CONST_CS | CONST_PERSISTENT);
 	REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT",			PHP_STREAM_CLIENT_CONNECT,	CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("STREAM_CLIENT_NO_DELAY",		PHP_STREAM_CLIENT_NO_DELAY,			CONST_CS | CONST_PERSISTENT);
 
 	REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT",		STREAM_CRYPTO_METHOD_SSLv2_CLIENT,	CONST_CS|CONST_PERSISTENT);
 	REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT",		STREAM_CRYPTO_METHOD_SSLv3_CLIENT,	CONST_CS|CONST_PERSISTENT);
Index: ext/standard/streamsfuncs.c
===================================================================
--- ext/standard/streamsfuncs.c	(revision 308439)
+++ ext/standard/streamsfuncs.c	(working copy)
@@ -32,9 +32,11 @@
 #include "php_string.h"
 
 #ifndef PHP_WIN32
+#include <netinet/tcp.h>
 #define php_select(m, r, w, e, t)	select(m, r, w, e, t)
 typedef unsigned long long php_timeout_ull;
 #else
+#include <winsock.h>
 #include "win32/select.h"
 #include "win32/sockets.h"
 typedef unsigned __int64 php_timeout_ull;
@@ -134,7 +136,8 @@
 
 	stream = php_stream_xport_create(host, host_len, ENFORCE_SAFE_MODE | REPORT_ERRORS,
 			STREAM_XPORT_CLIENT | (flags & PHP_STREAM_CLIENT_CONNECT ? STREAM_XPORT_CONNECT : 0) |
-			(flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0),
+			(flags & PHP_STREAM_CLIENT_ASYNC_CONNECT ? STREAM_XPORT_CONNECT_ASYNC : 0) |
+			(flags & PHP_STREAM_CLIENT_NO_DELAY ? TCP_NODELAY : 0),
 			hashkey, &tv, context, &errstr, &err);
 
 
Index: ext/standard/streamsfuncs.h
===================================================================
--- ext/standard/streamsfuncs.h	(revision 308439)
+++ ext/standard/streamsfuncs.h	(working copy)
@@ -22,6 +22,7 @@
 #define PHP_STREAM_CLIENT_PERSISTENT	1
 #define PHP_STREAM_CLIENT_ASYNC_CONNECT	2
 #define PHP_STREAM_CLIENT_CONNECT		4
+#define PHP_STREAM_CLIENT_NO_DELAY	8
 
 PHP_FUNCTION(stream_socket_client);
 PHP_FUNCTION(stream_socket_server);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 08:01:27 2024 UTC