Makes CancellationToken optional in public methods. Authenticator, MtProtoPlainSender, MtProtoSender

This commit is contained in:
Ruslan Iarmukhamedov 2019-10-26 13:02:10 +06:00
parent de79619b05
commit 21f2d98f5e
3 changed files with 7 additions and 7 deletions

View file

@ -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();

View file

@ -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();

View file

@ -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();