diff --git a/src/danog/MadelineProto/DataCenter.php b/src/danog/MadelineProto/DataCenter.php
index 5d74d0d8..16c57785 100644
--- a/src/danog/MadelineProto/DataCenter.php
+++ b/src/danog/MadelineProto/DataCenter.php
@@ -13,7 +13,7 @@ If not, see .
namespace danog\MadelineProto;
/**
- * Manages all of the mtproto stuff.
+ * Manages datacenters.
*/
class DataCenter extends Tools
{
@@ -36,10 +36,18 @@ class DataCenter extends Tools
];
}
}
+ $this->dc_connect(2);
}
- public function connnect($dc_number, $settings = [])
+ public function dc_disconnect($dc_number) {
+ unset($this->sockets[$dc_number]);
+ }
+
+ public function dc_connect($dc_number, $settings = [])
{
+ if (isset($this->sockets[$dc_number])) {
+ return;
+ }
if ($settings == []) {
$settings = $this->settings[$dc_number];
}
diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php
index b24f45e3..601e9074 100644
--- a/src/danog/MadelineProto/MTProto.php
+++ b/src/danog/MadelineProto/MTProto.php
@@ -62,6 +62,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
'all' => [
'protocol' => 'tcp_full',
'test_mode' => true,
+ 'port' => '443',
],
],
'app_info' => [
@@ -104,8 +105,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
// Connect to servers
$this->connection = new DataCenter($this->settings['connection'], $this->settings['connection_settings']);
- var_dump($this->connection);
- $this->connection->connect(2);
+ $this->connection->dc_connect(2);
// Load rsa key
$this->key = new RSA($settings['authorization']['rsa_key']);
diff --git a/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php b/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php
index d1446dd8..cad0f019 100644
--- a/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php
+++ b/src/danog/MadelineProto/MTProtoTools/AuthKeyHandler.php
@@ -419,7 +419,7 @@ class AuthKeyHandler extends AckHandler
throw new Exception('Handshake: wrong new_nonce_hash1');
}
- $this->log->log('Diffie Hellman key exchange processed successfully');
+ $this->log->log('Handshake: Diffie Hellman key exchange processed successfully');
$res_authorization['server_salt'] = $this->struct->unpack('log->log('Auth key generated');
+ $this->log->log('Handshake: Auth key generated');
$this->timedelta = 0;
return $res_authorization;