Skip to content
Merged
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
7 changes: 5 additions & 2 deletions src/Query/TcpTransportExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ class TcpTransportExecutor implements ExecutorInterface
private $readBuffer = '';
private $readPending = false;

/** @var string */
private $readChunk = 0xffff;

/**
* @param string $nameserver
* @param ?LoopInterface $loop
Expand Down Expand Up @@ -181,7 +184,7 @@ public function query(Query $query)
// set socket to non-blocking and wait for it to become writable (connection success/rejected)
\stream_set_blocking($socket, false);
if (\function_exists('stream_set_chunk_size')) {
\stream_set_chunk_size($socket, (int) ((1 << 31) - 1)); // @codeCoverageIgnore
\stream_set_chunk_size($socket, $this->readChunk); // @codeCoverageIgnore
}
$this->socket = $socket;
}
Expand Down Expand Up @@ -270,7 +273,7 @@ public function handleRead()
{
// read one chunk of data from the DNS server
// any error is fatal, this is a stream of TCP/IP data
$chunk = @\fread($this->socket, 65536);
$chunk = @\fread($this->socket, $this->readChunk);
if ($chunk === false || $chunk === '') {
$this->closeError('Connection to DNS server ' . $this->nameserver . ' lost');
return;
Expand Down