Handle bad_msg_notifications in response to containers
This commit is contained in:
parent
782e145072
commit
d5fe532e22
@ -250,10 +250,6 @@ class Connection
|
|||||||
|
|
||||||
public function read($length)
|
public function read($length)
|
||||||
{
|
{
|
||||||
if ($this->must_open) {
|
|
||||||
$this->__construct($this->proxy, $this->extra, $this->ip, $this->port, $this->protocol, $this->timeout, $this->ipv6);
|
|
||||||
$this->must_open = false;
|
|
||||||
}
|
|
||||||
switch ($this->protocol) {
|
switch ($this->protocol) {
|
||||||
case 'obfuscated2':
|
case 'obfuscated2':
|
||||||
$packet = '';
|
$packet = '';
|
||||||
|
@ -560,9 +560,9 @@ class MTProto
|
|||||||
public function close_and_reopen($datacenter)
|
public function close_and_reopen($datacenter)
|
||||||
{
|
{
|
||||||
$this->datacenter->sockets[$datacenter]->close_and_reopen();
|
$this->datacenter->sockets[$datacenter]->close_and_reopen();
|
||||||
if ($this->is_http($datacenter) && $this->datacenter->sockets[$datacenter]->temp_auth_key !== null && isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) && $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] === true) {
|
/*if ($this->is_http($datacenter) && $this->datacenter->sockets[$datacenter]->temp_auth_key !== null && isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) && $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] === true) {
|
||||||
$this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]);
|
$this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info
|
// Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info
|
||||||
|
@ -129,7 +129,6 @@ trait MessageHandler
|
|||||||
throw new \danog\MadelineProto\SecurityException('Got unknown auth_key id');
|
throw new \danog\MadelineProto\SecurityException('Got unknown auth_key id');
|
||||||
}
|
}
|
||||||
$deserialized = $this->deserialize($message_data, ['type' => '', 'datacenter' => $datacenter]);
|
$deserialized = $this->deserialize($message_data, ['type' => '', 'datacenter' => $datacenter]);
|
||||||
//var_dump($deserialized);
|
|
||||||
$this->datacenter->sockets[$datacenter]->incoming_messages[$message_id]['content'] = $deserialized;
|
$this->datacenter->sockets[$datacenter]->incoming_messages[$message_id]['content'] = $deserialized;
|
||||||
$this->datacenter->sockets[$datacenter]->incoming_messages[$message_id]['response'] = -1;
|
$this->datacenter->sockets[$datacenter]->incoming_messages[$message_id]['response'] = -1;
|
||||||
$this->datacenter->sockets[$datacenter]->new_incoming[$message_id] = $message_id;
|
$this->datacenter->sockets[$datacenter]->new_incoming[$message_id] = $message_id;
|
||||||
|
@ -102,6 +102,21 @@ trait ResponseHandler
|
|||||||
$this->ack_outgoing_message_id($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id'], $datacenter);
|
$this->ack_outgoing_message_id($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id'], $datacenter);
|
||||||
// Acknowledge that the server received my request
|
// Acknowledge that the server received my request
|
||||||
$this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]['response'] = $current_msg_id;
|
$this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]['response'] = $current_msg_id;
|
||||||
|
|
||||||
|
switch ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['error_code']) {
|
||||||
|
case 48:
|
||||||
|
$this->datacenter->sockets[$datacenter]->temp_auth_key['server_salt'] = $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['new_server_salt'];
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
case 17:
|
||||||
|
\danog\MadelineProto\Logger::log(['Received bad_msg_notification: '.self::BAD_MSG_ERROR_CODES[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['error_code']]], \danog\MadelineProto\Logger::WARNING);
|
||||||
|
$this->datacenter->sockets[$datacenter]->time_delta = (int) (new \phpseclib\Math\BigInteger(strrev($current_message_id), 256))->bitwise_rightShift(32)->subtract(new \phpseclib\Math\BigInteger(time()))->toString();
|
||||||
|
\danog\MadelineProto\Logger::log(['Set time delta to '.$this->datacenter->sockets[$datacenter]->time_delta], \danog\MadelineProto\Logger::WARNING);
|
||||||
|
$this->reset_session();
|
||||||
|
$this->datacenter->sockets[$datacenter]->temp_auth_key = null;
|
||||||
|
$this->init_authorization();
|
||||||
|
break;
|
||||||
|
}
|
||||||
unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]);
|
unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]);
|
||||||
unset($this->datacenter->sockets[$datacenter]->new_outgoing[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]);
|
unset($this->datacenter->sockets[$datacenter]->new_outgoing[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]);
|
||||||
break;
|
break;
|
||||||
|
@ -35,7 +35,6 @@ class Serialization
|
|||||||
if ($file[0] !== '/') {
|
if ($file[0] !== '/') {
|
||||||
$file = getcwd().'/'.$file;
|
$file = getcwd().'/'.$file;
|
||||||
}
|
}
|
||||||
var_dump(getcwd());
|
|
||||||
|
|
||||||
return ['file' => $file, 'lockfile' => $file.'.lock', 'tempfile' => $file.'.temp.session'];
|
return ['file' => $file, 'lockfile' => $file.'.lock', 'tempfile' => $file.'.temp.session'];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user