Issue 1843 - RCON worker threads synchronization corrected

This commit is contained in:
Milosz Danielewski
2014-08-07 10:19:23 +02:00
parent 269a10fadd
commit 5242e87026
2 changed files with 12 additions and 4 deletions

View File

@ -133,7 +133,9 @@ class RCONInstance extends \Thread{
if($payload === $this->password){
@socket_getpeername($client, $addr, $port);
$this->response = "[INFO] Successful Rcon connection from: /$addr:$port";
$this->wait();
$this->synchronized(function($thread){
$thread->wait();
}, $this);
$this->response = "";
$this->writePacket($client, $requestID, 2, "");
$this->{"status" . $n} = 1;
@ -150,7 +152,9 @@ class RCONInstance extends \Thread{
}
if(strlen($payload) > 0){
$this->cmd = ltrim($payload);
$this->wait();
$this->synchronized(function($thread){
$thread->wait();
}, $this);
$this->writePacket($client, $requestID, 0, str_replace("\n", "\r\n", trim($this->response)));
$this->response = "";
$this->cmd = "";