fix: Interop not closing socket + discard keepalive packets

This commit is contained in:
SeekDaSky 2017-12-07 15:35:07 +01:00
parent 5d9e6ef83f
commit 4f6fa13155
2 changed files with 10 additions and 1 deletions

View File

@ -35,7 +35,10 @@
} }
public function receive() : array{ public function receive() : array{
$size = 0;
while($size == 0){
$size = unpack("N",socket_read($this->socket,4))[1]; $size = unpack("N",socket_read($this->socket,4))[1];
}
$read = 0; $read = 0;
$data = ""; $data = "";
$tmp = ""; $tmp = "";
@ -51,4 +54,9 @@
return json_decode($data,true); return json_decode($data,true);
} }
public function close(){
socket_shutdown($this->socket);
socket_close($this->socket);
}
} }

View File

@ -60,6 +60,7 @@
$_SESSION['NAME'] = $check['name']; $_SESSION['NAME'] = $check['name'];
} }
$wsi->close();
$wsi = null; $wsi = null;
} }