Beispiel #1
0
        public async Task Connect(ServerInfo server)
        {
            await clientNetworkProvider.Connect(server);

            isConnected = true;
            timeoutChecker?.Dispose();
            timeoutChecker = new Timer((o) => EvaluateTimeouts(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100));
            this.OnDisposed(timeoutChecker.Dispose);
        }
Beispiel #2
0
        public Promise Connect(ServerInfo server)
        {
            var ret = clientNetworkProvider.Connect(server);

            ret.Then(() =>
            {
                isConnected = true;
                timeoutChecker?.Dispose();
                timeoutChecker = new Timer((o) => EvaluateTimeouts(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100));
                this.OnDisposed(timeoutChecker.Dispose);
            });
            return(ret);
        }