mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 07:18:57 +01:00
Bugfixes in response management
This commit is contained in:
parent
dd6803e4d7
commit
ea197a115f
@ -25,7 +25,7 @@
|
||||
"ext-fileinfo": "*",
|
||||
"amphp/amp": "^2.0",
|
||||
"amphp/websocket-client": "dev-master as 1.0.0-rc2",
|
||||
"amphp/http-client": "^4",
|
||||
"amphp/http-client": "dev-master as 4",
|
||||
"amphp/socket": "^1",
|
||||
"amphp/dns": "^1",
|
||||
"amphp/file": "^1",
|
||||
|
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit 67daced51adb23487f77f5526a4ae9e0dbc841b5
|
||||
Subproject commit 4ed3a8447cf21c69322bcdaf149eb3ce0befe8c0
|
@ -46,6 +46,10 @@ trait AckHandler
|
||||
public function gotResponseForOutgoingMessageId($message_id): bool
|
||||
{
|
||||
// The server acknowledges that it received my message
|
||||
if (isset($this->new_outgoing[$message_id])) {
|
||||
unset($this->new_outgoing[$message_id]);
|
||||
}
|
||||
|
||||
if (!isset($this->outgoing_messages[$message_id])) {
|
||||
$this->logger->logger("WARNING: Couldn't find message id ".$message_id.' in the array of outgoing messages. Maybe try to increase its size?', \danog\MadelineProto\Logger::WARNING);
|
||||
|
||||
@ -57,9 +61,6 @@ trait AckHandler
|
||||
if (isset($this->outgoing_messages[$message_id]['serialized_body'])) {
|
||||
unset($this->outgoing_messages[$message_id]['serialized_body']);
|
||||
}
|
||||
if (isset($this->new_outgoing[$message_id])) {
|
||||
unset($this->new_outgoing[$message_id]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ trait ResponseHandler
|
||||
}
|
||||
$this->gotResponseForOutgoingMessageId($request_id);
|
||||
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], $request['_'] ?? ''));
|
||||
|
||||
return;
|
||||
case 303:
|
||||
@ -445,7 +445,7 @@ trait ResponseHandler
|
||||
\danog\MadelineProto\Tools::callFork((function () use (&$request, &$response) {
|
||||
yield $this->API->initAuthorization();
|
||||
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], $request['_'] ?? ''));
|
||||
})());
|
||||
|
||||
return;
|
||||
@ -457,7 +457,7 @@ trait ResponseHandler
|
||||
\danog\MadelineProto\Tools::callFork((function () use (&$request, &$response) {
|
||||
yield $this->API->initAuthorization();
|
||||
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], $request['_'] ?? ''));
|
||||
})());
|
||||
|
||||
return;
|
||||
@ -490,7 +490,7 @@ trait ResponseHandler
|
||||
\danog\MadelineProto\Tools::callFork((function () use (&$request, &$response) {
|
||||
yield $this->API->initAuthorization();
|
||||
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], $request['_'] ?? ''));
|
||||
})());
|
||||
|
||||
return;
|
||||
@ -515,7 +515,7 @@ trait ResponseHandler
|
||||
}
|
||||
$this->gotResponseForOutgoingMessageId($request_id);
|
||||
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], $request['_'] ?? ''));
|
||||
|
||||
return;
|
||||
case 420:
|
||||
@ -534,7 +534,7 @@ trait ResponseHandler
|
||||
default:
|
||||
$this->gotResponseForOutgoingMessageId($request_id);
|
||||
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException($response['error_message'], $response['error_code'], $request['_'] ?? ''));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -567,7 +567,7 @@ trait ResponseHandler
|
||||
return;
|
||||
}
|
||||
$this->gotResponseForOutgoingMessageId($request_id);
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException('Received bad_msg_notification: '.MTProto::BAD_MSG_ERROR_CODES[$response['error_code']], $response['error_code'], isset($request['_']) ? $request['_'] : ''));
|
||||
$this->handleReject($request, new \danog\MadelineProto\RPCErrorException('Received bad_msg_notification: '.MTProto::BAD_MSG_ERROR_CODES[$response['error_code']], $response['error_code'], $request['_'] ?? ''));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -578,6 +578,7 @@ trait ResponseHandler
|
||||
}
|
||||
|
||||
if (!isset($request['promise'])) {
|
||||
$this->gotResponseForOutgoingMessageId($request_id);
|
||||
$this->logger->logger('Response: already got response for '.(isset($request['_']) ? $request['_'] : '-').' with message ID '.$request_id);
|
||||
|
||||
return;
|
||||
|
@ -987,7 +987,7 @@ class TL
|
||||
}
|
||||
if ($constructorData['type'] === 'Vector t') {
|
||||
$constructorData['connection'] = $type['connection'];
|
||||
$constructorData['subtype'] = isset($type['subtype']) ? $type['subtype'] : '';
|
||||
$constructorData['subtype'] = $type['subtype'] ?? '';
|
||||
$constructorData['type'] = 'vector';
|
||||
|
||||
return $this->deserialize($stream, $constructorData);
|
||||
|
Loading…
Reference in New Issue
Block a user