Skip to content

Commit cb73edb

Browse files
committed
Getting out of ideas...
1 parent d14d4df commit cb73edb

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/ClamAV/Network.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ public function __construct(string $host = self::CLAMAV_HOST, int $port = self::
5050
protected function getSocket(): Socket
5151
{
5252
$socket = @\socket_create(AF_INET, SOCK_STREAM, 0);
53+
$status = @\socket_connect($socket, $this->host, $this->port);
5354

54-
if (!@\socket_connect($socket, $this->host, $this->port)) {
55+
if (!$status) {
5556
throw new RuntimeException('Unable to connect to ClamAV server');
5657
}
5758

src/ClamAV/Pipe.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Appwrite\ClamAV;
1313

14-
use RuntimeException;
1514
use Socket;
1615

1716
use const AF_UNIX;
@@ -42,11 +41,8 @@ public function __construct(string $pip = self::CLAMAV_SOCK)
4241
*/
4342
protected function getSocket(): Socket
4443
{
45-
$socket = @\socket_create(AF_UNIX, SOCK_STREAM, 0);
46-
47-
if (!@\socket_connect($socket, $this->pip)) {
48-
throw new RuntimeException('Unable to connect to ClamAV server');
49-
}
44+
$socket = \socket_create(AF_UNIX, SOCK_STREAM, 0);
45+
\socket_connect($socket, $this->pip);
5046

5147
return $socket;
5248
}

0 commit comments

Comments
 (0)