32 bit bugfixes
This commit is contained in:
parent
fa987e718b
commit
432fc32d05
@ -48,7 +48,6 @@ class MTProto
|
||||
public $bigint = false;
|
||||
public $run_workers = false;
|
||||
public $threads = false;
|
||||
public $readers = [];
|
||||
|
||||
public function __construct($settings = [])
|
||||
{
|
||||
@ -116,6 +115,9 @@ class MTProto
|
||||
if (!isset($this->reader_pool)) {
|
||||
$this->reader_pool = new \Pool(count($dcs));
|
||||
}
|
||||
if (!isset($this->readers)) {
|
||||
$this->readers = [];
|
||||
}
|
||||
foreach ($dcs as $dc) {
|
||||
if (!isset($this->readers[$dc])) {
|
||||
$this->readers[$dc] = new \danog\MadelineProto\Threads\SocketReader($this, $dc);
|
||||
@ -137,6 +139,9 @@ class MTProto
|
||||
if (isset($t['reader_pool'])) {
|
||||
unset($t['reader_pool']);
|
||||
}
|
||||
if (isset($t['readers'])) {
|
||||
unset($t['readers']);
|
||||
}
|
||||
|
||||
return array_keys($t);
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ trait CallHandler
|
||||
throw new \danog\MadelineProto\Exception('No datacenter provided');
|
||||
}
|
||||
$args = $this->botAPI_to_MTProto($args);
|
||||
if (isset($args['ping_id']) && is_integer($args['ping_id'])) {
|
||||
$args['ping_id'] = \danog\PHP\Struct::pack('<q', $args['ping_id']);
|
||||
}
|
||||
$serialized = $this->serialize_method($method, $args);
|
||||
$content_related = $this->content_related($method);
|
||||
$type = $this->methods->find_by_method($method)['type'];
|
||||
|
@ -22,12 +22,13 @@ trait SeqNoHandler
|
||||
$in = $content_related ? 1 : 0;
|
||||
$value = $this->datacenter->sockets[$datacenter]->session_out_seq_no;
|
||||
$this->datacenter->sockets[$datacenter]->session_out_seq_no += $in;
|
||||
|
||||
//var_dump("OUT $datacenter: $value + $in = ".$this->datacenter->sockets[$datacenter]->session_out_seq_no);
|
||||
return ($value * 2) + $in;
|
||||
}
|
||||
|
||||
public function check_in_seq_no($datacenter, $current_msg_id)
|
||||
{
|
||||
|
||||
if (isset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['seq_no']) && ($seq_no = $this->generate_in_seq_no($datacenter, $this->content_related($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_']))) !== $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['seq_no']) {
|
||||
\danog\MadelineProto\Logger::log(['SECURITY WARNING: Seqno mismatch (should be '.$seq_no.', is '.$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['seq_no'].', '.$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_'].')'], \danog\MadelineProto\Logger::ERROR);
|
||||
}
|
||||
@ -38,12 +39,13 @@ trait SeqNoHandler
|
||||
$in = $content_related ? 1 : 0;
|
||||
$value = $this->datacenter->sockets[$datacenter]->session_in_seq_no;
|
||||
$this->datacenter->sockets[$datacenter]->session_in_seq_no += $in;
|
||||
|
||||
//var_dump("IN $datacenter: $value + $in = ".$this->datacenter->sockets[$datacenter]->session_in_seq_no);
|
||||
return ($value * 2) + $in;
|
||||
}
|
||||
|
||||
public function content_related($method)
|
||||
{
|
||||
//var_dump($method);
|
||||
return !in_array(
|
||||
$method,
|
||||
[
|
||||
|
@ -554,7 +554,7 @@ trait TL
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (in_array($arg['name'], ['msg_ids', 'msg_id', 'bad_msg_id', 'req_msg_id', 'answer_msg_id', 'first_msg_id', 'key_fingerprint', 'server_salt', 'new_server_salt', 'server_public_key_fingerprints'])) {
|
||||
if (in_array($arg['name'], ['msg_ids', 'msg_id', 'bad_msg_id', 'req_msg_id', 'answer_msg_id', 'first_msg_id', 'key_fingerprint', 'server_salt', 'new_server_salt', 'server_public_key_fingerprints', 'ping_id'])) {
|
||||
$arg['strlong'] = true;
|
||||
}
|
||||
$x[$arg['name']] = $this->deserialize($bytes_io, $arg);
|
||||
|
Loading…
Reference in New Issue
Block a user