Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": ">=8.2",
"freedsx/asn1": "dev-main#bb89093",
"freedsx/socket": "dev-main#756a6e6",
"freedsx/socket": "dev-main#45fe6ca",
"freedsx/sasl": "dev-main#525d0e9",
"psr/log": "^3"
},
Expand Down
3 changes: 2 additions & 1 deletion src/FreeDSx/Ldap/Server/SocketServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public function makeAndBind(): SocketServer
->setSslAllowSelfSigned($this->network->getSslAllowSelfSigned())
->setSslCaCert($this->network->getSslCaCert())
->setTimeoutHandshake($this->network->getSslHandshakeTimeout())
->setReusePort($this->reusePort);
->setReusePort($this->reusePort)
->setTcpNoDelay(!$isUnixSocket);

return SocketServer::bind(
$resource,
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/Server/SocketServerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@ public function test_it_should_make_a_unix_based_socket_server(): void
$this->subject->makeAndBind();
}

public function test_it_disables_nagle_on_tcp_connections(): void
{
self::assertTrue($this->subject->makeAndBind()->getOptions()->isTcpNoDelay());
}

public function test_it_leaves_nagle_alone_on_a_unix_socket(): void
{
$this->requireUnix('Cannot construct unix based socket on Windows.');

$subject = new SocketServerFactory(
(new NetworkConfig())
->setUnixSocket($this->tmpUnixSocketFilePath)
->setTransport('unix'),
RunnerMode::Pcntl,
);

self::assertFalse($subject->makeAndBind()->getOptions()->isTcpNoDelay());
}

public function test_an_existing_socket_that_is_not_writeable_is_recorded_and_refused(): void
{
$this->requireUnix('Cannot construct unix based socket on Windows.');
Expand Down
Loading