Improved logging and disconnect
This commit is contained in:
parent
387584a178
commit
6a6066b8ad
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit f76840d014585d3ffbe8a272cd967c3d6321c096
|
Subproject commit ae6f992aef745fecfa989ad01f959a467d94c7ae
|
@ -28,6 +28,7 @@ use danog\MadelineProto\MTProtoTools\Crypt;
|
|||||||
use danog\MadelineProto\Stream\ConnectionContext;
|
use danog\MadelineProto\Stream\ConnectionContext;
|
||||||
use danog\MadelineProto\Stream\MTProtoTools\MsgIdHandler;
|
use danog\MadelineProto\Stream\MTProtoTools\MsgIdHandler;
|
||||||
use danog\MadelineProto\Stream\MTProtoTools\SeqNoHandler;
|
use danog\MadelineProto\Stream\MTProtoTools\SeqNoHandler;
|
||||||
|
use Amp\ByteStream\ClosedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connection class.
|
* Connection class.
|
||||||
@ -200,7 +201,11 @@ class Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->stream) {
|
if ($this->stream) {
|
||||||
|
try {
|
||||||
$this->stream->disconnect();
|
$this->stream->disconnect();
|
||||||
|
} catch (ClosedException $e) {
|
||||||
|
$this->API->logger->logger($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->API->logger->logger("Disconnected from DC {$this->datacenter}");
|
$this->API->logger->logger("Disconnected from DC {$this->datacenter}");
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,9 @@ class Logger
|
|||||||
if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread())) {
|
if (\danog\MadelineProto\Magic::$has_thread && is_object(\Thread::getCurrentThread())) {
|
||||||
$prefix .= ' (t)';
|
$prefix .= ' (t)';
|
||||||
}
|
}
|
||||||
if (!is_string($param)) {
|
if ($param instanceof \Throwable) {
|
||||||
|
$param = (string) $param;
|
||||||
|
} else if (!is_string($param)) {
|
||||||
$param = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
$param = json_encode($param, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
if ($file === null) {
|
if ($file === null) {
|
||||||
|
@ -228,7 +228,10 @@ class MTProto extends AsyncConstruct implements TLCallback
|
|||||||
{
|
{
|
||||||
return ['supportUser', 'referenceDatabase', 'channel_participants', 'event_handler', 'event_handler_instance', 'loop_callback', 'web_template', 'encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'dh_config', 'chats', 'last_stored', 'qres', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'tl_callbacks', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'authorized_dc', 'tos'];
|
return ['supportUser', 'referenceDatabase', 'channel_participants', 'event_handler', 'event_handler_instance', 'loop_callback', 'web_template', 'encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'dh_config', 'chats', 'last_stored', 'qres', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'tl_callbacks', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'authorized_dc', 'tos'];
|
||||||
}
|
}
|
||||||
|
public function logger(...$params)
|
||||||
|
{
|
||||||
|
return $this->logger->logger(...$params);
|
||||||
|
}
|
||||||
public function isAltervista()
|
public function isAltervista()
|
||||||
{
|
{
|
||||||
return Magic::$altervista;
|
return Magic::$altervista;
|
||||||
|
Loading…
Reference in New Issue
Block a user