mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Makes CancellationToken optional in public methods. Authenticator, MtProtoPlainSender, MtProtoSender
This commit is contained in:
parent
de79619b05
commit
21f2d98f5e
|
|
@ -6,7 +6,7 @@ namespace TLSharp.Core.Auth
|
|||
{
|
||||
public static class Authenticator
|
||||
{
|
||||
public static async Task<Step3_Response> DoAuthentication(TcpTransport transport, CancellationToken token)
|
||||
public static async Task<Step3_Response> DoAuthentication(TcpTransport transport, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace TLSharp.Core.Network
|
|||
_random = new Random();
|
||||
}
|
||||
|
||||
public async Task Send(byte[] data, CancellationToken token)
|
||||
public async Task Send(byte[] data, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<byte[]> Receive(CancellationToken token)
|
||||
public async Task<byte[]> Receive(CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace TLSharp.Core.Network
|
|||
return confirmed ? _session.Sequence++ * 2 + 1 : _session.Sequence * 2;
|
||||
}
|
||||
|
||||
public async Task Send(TeleSharp.TL.TLMethod request, CancellationToken token)
|
||||
public async Task Send(TeleSharp.TL.TLMethod request, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ namespace TLSharp.Core.Network
|
|||
_session.Save();
|
||||
}
|
||||
|
||||
public async Task Send(byte[] packet, TeleSharp.TL.TLMethod request, CancellationToken token)
|
||||
public async Task Send(byte[] packet, TeleSharp.TL.TLMethod request, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ namespace TLSharp.Core.Network
|
|||
return new Tuple<byte[], ulong, int>(message, remoteMessageId, remoteSequence);
|
||||
}
|
||||
|
||||
public async Task<byte[]> Receive(TeleSharp.TL.TLMethod request, CancellationToken token)
|
||||
public async Task<byte[]> Receive(TeleSharp.TL.TLMethod request, CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
while (!request.ConfirmReceived)
|
||||
{
|
||||
|
|
@ -148,7 +148,7 @@ namespace TLSharp.Core.Network
|
|||
return null;
|
||||
}
|
||||
|
||||
public async Task SendPingAsync(CancellationToken token)
|
||||
public async Task SendPingAsync(CancellationToken token = default(CancellationToken))
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue