Exemple #1
0
        private async Task MakeRequestAtDataCenterWithTemporarySubClient(TLMethod request, int dataCenter)
        {
            var fakeStore = new FakeSessionStore();
            var subClient = new TelegramClient(_apiId, _apiHash, fakeStore, "session", null, _useIpV6DataCenters)
            {
                _session   = Session.FromBytes(_session.ToBytes(), fakeStore, "session"),
                _transport = new TcpTransport(_session.DataCenter.Address, _session.DataCenter.Port, _handler)
            };
            await subClient.ConnectAsync();

            await subClient.ReconnectToDcAsync(dataCenter);

            request.ConfirmReceived = false;
            await subClient.RequestWithDcMigration(request);

            _session.LastMessageId = subClient._session.LastMessageId;
            _session.Sequence      = subClient._session.Sequence;
        }