mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Added checks
This commit is contained in:
parent
8bf4b5cafa
commit
84ac13d591
@ -35,4 +35,5 @@ require_once(FILE_PATH."/src/dependencies.php");
|
|||||||
$server = new ServerAPI();
|
$server = new ServerAPI();
|
||||||
$server->run();
|
$server->run();
|
||||||
|
|
||||||
|
|
||||||
kill(getmypid()); //Fix for segfault
|
kill(getmypid()); //Fix for segfault
|
||||||
|
@ -77,13 +77,19 @@ class UDPSocket{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function read(){
|
public function read(){
|
||||||
|
if($this->connected === false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$source = false;
|
$source = false;
|
||||||
$port = 1;
|
$port = 1; //$source and $port will be overwritten
|
||||||
$len = @socket_recvfrom($this->sock, $buf, 65536, 0, $source, $port);
|
$len = @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
|
||||||
return array($buf, $source, $port, $len);
|
return array($buf, $source, $port, $len);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function write($data, $dest = false, $port = false){
|
public function write($data, $dest = false, $port = false){
|
||||||
|
if($this->connected === false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return @socket_sendto($this->sock, $data, strlen($data), 0, ($dest === false ? $this->server:$dest), ($port === false ? $this->port:$port));
|
return @socket_sendto($this->sock, $data, strlen($data), 0, ($dest === false ? $this->server:$dest), ($port === false ? $this->port:$port));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user