mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
TelegramClient: change Connect() to return void instead of always true
If a method that returns bool is never returning false, it's essentially not giving any information at all, which means that it should return void. This will help the consumers of this API to stop thinking that the result of this function means if the connection was succesful (which it is, actually, but it was never returning false because if there's any problem connecting, the result would be an exception instead).
This commit is contained in:
parent
4ce0f72d6d
commit
bf568d80cc
|
|
@ -50,7 +50,7 @@ namespace TLSharp.Core
|
||||||
_transport = new TcpTransport(_session.ServerAddress, _session.Port, _handler);
|
_transport = new TcpTransport(_session.ServerAddress, _session.Port, _handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> ConnectAsync(bool reconnect = false)
|
public async Task ConnectAsync(bool reconnect = false)
|
||||||
{
|
{
|
||||||
if (_session.AuthKey == null || reconnect)
|
if (_session.AuthKey == null || reconnect)
|
||||||
{
|
{
|
||||||
|
|
@ -77,8 +77,6 @@ namespace TLSharp.Core
|
||||||
await _sender.Receive(invokewithLayer);
|
await _sender.Receive(invokewithLayer);
|
||||||
|
|
||||||
dcOptions = ((TLConfig)invokewithLayer.Response).DcOptions.ToList();
|
dcOptions = ((TLConfig)invokewithLayer.Response).DcOptions.ToList();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ReconnectToDcAsync(int dcId)
|
private async Task ReconnectToDcAsync(int dcId)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue