mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-23 01:26:11 +02:00
Make sure handlers can be closed multiple times
This commit is contained in:
@@ -29,11 +29,17 @@ class UdpSocket
|
||||
|
||||
public function close()
|
||||
{
|
||||
socket_close($this->socket);
|
||||
if (is_resource($this->socket)) {
|
||||
socket_close($this->socket);
|
||||
$this->socket = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected function send($chunk)
|
||||
{
|
||||
if (!is_resource($this->socket)) {
|
||||
throw new \LogicException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore');
|
||||
}
|
||||
socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user