public async Task <MTProtoGateway> GetFileGateway(ulong salt) { await _lock.WaitAsync(); // fileGateway = new MTProtoGateway(this, fileSession); try { if (fileGateway != null) { return(fileGateway); } if (fileSession == null) { fileSession = new TelegramFileSession(Helpers.GenerateRandomUlong(), 0); } fileGateway = new MTProtoGateway(this, fileSession, false, salt); await fileGateway.ConnectAsync(); return(fileGateway); } finally { _lock.Release(); } }
public async Task<MTProtoGateway> GetFileGateway(ulong salt) { await _lock.WaitAsync(); // fileGateway = new MTProtoGateway(this, fileSession); try { if (fileGateway != null) { return fileGateway; } if (fileSession == null) { fileSession = new TelegramFileSession(Helpers.GenerateRandomUlong(), 0); } fileGateway = new MTProtoGateway(this, fileSession, false, salt); await fileGateway.ConnectAsync(); return fileGateway; } finally { _lock.Release(); } }