Skip to content

Commit 4868ceb

Browse files
authored
fix issue #22
1 parent d8d8b8d commit 4868ceb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Transport/SocketTransport.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ public function open()
239239
$r = @socket_connect($socket6, $ip, $port);
240240
if ($r) {
241241
if ($this->debug) call_user_func($this->debugHandler, "Connected to $ip:$port!");
242-
@socket_close($socket4);
242+
if (!empty($socket4)) {
243+
@socket_close($socket4);
244+
}
243245
$this->socket = $socket6;
244246
return;
245247
} elseif ($this->debug) {
@@ -253,7 +255,9 @@ public function open()
253255
$r = @socket_connect($socket4, $ip, $port);
254256
if ($r) {
255257
if ($this->debug) call_user_func($this->debugHandler, "Connected to $ip:$port!");
256-
@socket_close($socket6);
258+
if (!empty($socket6)) {
259+
@socket_close($socket6);
260+
}
257261
$this->socket = $socket4;
258262
return;
259263
} elseif ($this->debug) {

0 commit comments

Comments
 (0)