mirror of
https://github.com/predis/predis.git
synced 2026-10-16 08:46:28 +00:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user