mirror of
https://github.com/danog/dns.git
synced 2024-11-26 20:14:51 +01:00
Unload server when fwrite fails
Ignore errors from fwrite caused by disconnected sockets and immediately unload the server.
This commit is contained in:
parent
5fc1cde2d2
commit
4e4d6e9f81
@ -195,11 +195,11 @@ REGEX;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send request
|
// Send request
|
||||||
$bytesWritten = \fwrite($server->socket, $requestPacket);
|
$bytesWritten = @\fwrite($server->socket, $requestPacket);
|
||||||
if ($bytesWritten === false || isset($packet[$bytesWritten])) {
|
if ($bytesWritten === false || $bytesWritten === 0 && (!\is_resource($server->socket) || !\feof($server->socket))) {
|
||||||
throw new ResolutionException(
|
$exception = new ResolutionException("Request send failed");
|
||||||
"Request send failed"
|
$this->unloadServer($server->id, $exception);
|
||||||
);
|
throw $exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
$promisor = new Deferred;
|
$promisor = new Deferred;
|
||||||
@ -265,6 +265,7 @@ REGEX;
|
|||||||
$uri = $this->parseCustomServerUri($options["server"]);
|
$uri = $this->parseCustomServerUri($options["server"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$promises = [];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$promises[] = $this->doRequest($uri, $name, $type);
|
$promises[] = $this->doRequest($uri, $name, $type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user