Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-03-02 12:33:22 +00:00 committed by StyleCI Bot
parent e2aef54979
commit 05a73fbe31
3 changed files with 5 additions and 2 deletions

View File

@ -127,6 +127,7 @@ class API extends APIFactory
\danog\MadelineProto\Logger::log('Detected fork'); \danog\MadelineProto\Logger::log('Detected fork');
$this->API->__wakeup(); $this->API->__wakeup();
} }
return $this->API->__construct($value); return $this->API->__construct($value);
} }

View File

@ -123,7 +123,7 @@ class APIFactory
if (Logger::is_fork()) { if (Logger::is_fork()) {
\danog\MadelineProto\Logger::log('Detected fork'); \danog\MadelineProto\Logger::log('Detected fork');
$this->API->reset_session(); $this->API->reset_session();
foreach ($this->API->datacenter->sockets as $datacenter) { foreach ($this->API->datacenter->sockets as $datacenter) {
$datacenter->close_and_reopen(); $datacenter->close_and_reopen();
} }
} }

View File

@ -68,10 +68,12 @@ class Logger
} }
} }
public static function is_fork() { public static function is_fork()
{
if (self::$pid === null) { if (self::$pid === null) {
self::$pid = getmypid(); self::$pid = getmypid();
} }
return self::$pid !== getmypid(); return self::$pid !== getmypid();
} }