915a0cd180
* I'll just leave this here * Threading fixes * Apply fixes from StyleCI * Composer fixes * Lots of threading fixes, included all RSA keys * Apply fixes from StyleCI * Updated phpseclib * fixes * Apply fixes from StyleCI * final fixes * git add -A * Apply fixes from StyleCI * bugfix * Fixes * Apply fixes from StyleCI * Small fixes * Final fixes * Speed improvements * speed fixes * Apply fixes from StyleCI * This is faster than sanic * Apply fixes from StyleCI * Final speed fixes * Apply fixes from StyleCI * Less logging * Speed+++ * Apply fixes from StyleCI * More fixes * Bug74586Exception * Apply fixes from StyleCI * Fixes * Lemme fix that dumb-ass bug that broke everything * Apply fixes from StyleCI * Updated rollbar token * Fixes for other tcp_* protocols * Apply fixes from StyleCI * No need for phpstruct anymore * Add a conflict (OH NOES pony warfare) * Less logs, beginning of clickable buttons * Apply fixes from StyleCI * Bugfixes, fixed clickable buttons * Apply fixes from StyleCI * Better errors * Apply fixes from StyleCI * You can now click text buttons * Apply fixes from StyleCI
48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
/*
|
|
Copyright 2016-2017 Daniil Gentili
|
|
(https://daniil.it)
|
|
This file is part of MadelineProto.
|
|
MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
See the GNU Affero General Public License for more details.
|
|
You should have received a copy of the GNU General Public License along with MadelineProto.
|
|
If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace danog\MadelineProto\Threads;
|
|
|
|
/**
|
|
* Manages packing and unpacking of messages, and the list of sent and received messages.
|
|
*/
|
|
class SocketHandler extends \Threaded implements \Collectable
|
|
{
|
|
public function __construct(&$me, $current)
|
|
{
|
|
$this->API = $me;
|
|
$this->current = $current;
|
|
}
|
|
|
|
/**
|
|
* Reading connection and receiving message from server. Check the CRC32.
|
|
*/
|
|
public function run()
|
|
{
|
|
require __DIR__.'/../../../../vendor/autoload.php';
|
|
$this->API->handle_messages($this->current);
|
|
$this->setGarbage();
|
|
}
|
|
|
|
protected $garbage = false;
|
|
|
|
public function setGarbage():void
|
|
{
|
|
$this->garbage = true;
|
|
}
|
|
|
|
public function isGarbage():bool
|
|
{
|
|
return $this->garbage;
|
|
}
|
|
}
|