Support TCP_NODELAY for stream-based connections on PHP >= 5.4.0.

This cannot be implemented for previous versions of PHP because we
need socket_import_stream() to extract the underlying socket resource
from the stream in order to be able to set the TCP_NODELAY flag.
This commit is contained in:
Daniele Alessandri
2013-02-16 11:03:28 +01:00
parent c38376dcc4
commit 8d01be388d
4 changed files with 45 additions and 0 deletions
@@ -69,6 +69,24 @@ class StreamConnectionTest extends ConnectionTestCase
// ---- INTEGRATION TESTS --------------------------------------------- //
// ******************************************************************** //
/**
* @group connected
*/
public function testAcceptsTcpNodelayParameter()
{
if (!version_compare(PHP_VERSION, '5.4.0', '>=')) {
$this->markTestSkipped('Setting TCP_NODELAY on PHP socket streams works on PHP >= 5.4.0');
}
$connection = new StreamConnection($this->getParameters(array('tcp_nodelay' => false)));
$connection->connect();
$this->assertTrue($connection->isConnected());
$connection = new StreamConnection($this->getParameters(array('tcp_nodelay' => true)));
$connection->connect();
$this->assertTrue($connection->isConnected());
}
/**
* @group connected
*/