mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +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->run();
|
||||
|
||||
|
||||
kill(getmypid()); //Fix for segfault
|
||||
|
@ -77,13 +77,19 @@ class UDPSocket{
|
||||
}
|
||||
|
||||
public function read(){
|
||||
if($this->connected === false){
|
||||
return false;
|
||||
}
|
||||
$source = false;
|
||||
$port = 1;
|
||||
$len = @socket_recvfrom($this->sock, $buf, 65536, 0, $source, $port);
|
||||
$port = 1; //$source and $port will be overwritten
|
||||
$len = @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
|
||||
return array($buf, $source, $port, $len);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user