Reduce memory usage

This commit is contained in:
Daniil Gentili 2018-05-09 11:37:58 +00:00
parent f53695316c
commit dd43474e75

View File

@ -70,6 +70,8 @@ class Proxy extends \danog\MadelineProto\Connection
$socket = $this->extra['madeline']->API->datacenter->sockets[$dc];
$socket->__construct($socket->proxy, $socket->extra, $socket->ip, $socket->port, $socket->protocol, $this->extra['timeout'], $socket->ipv6);
unset($this->extra);
$write = [];
$except = [];
@ -80,11 +82,11 @@ class Proxy extends \danog\MadelineProto\Connection
$read = [$this->getSocket(), $socket->getSocket()];
\Socket::select($read, $write, $except, 2);
if (isset($read[0])) {
\danog\MadelineProto\Logger::log("Will write to DC $dc on ".\danog\MadelineProto\Magic::$pid);
//\danog\MadelineProto\Logger::log("Will write to DC $dc on ".\danog\MadelineProto\Magic::$pid);
$socket->send_message($this->read_message());
}
if (isset($read[1])) {
\danog\MadelineProto\Logger::log("Will read from DC $dc on ".\danog\MadelineProto\Magic::$pid);
//\danog\MadelineProto\Logger::log("Will read from DC $dc on ".\danog\MadelineProto\Magic::$pid);
$this->send_message($socket->read_message());
}
} catch (\danog\MadelineProto\NothingInTheSocketException $e) {