예제 #1
0
            protected void initTimer()
            {
                try
                {
                    _Timer          = new DispatcherTimer();
                    _Timer.Interval = new TimeSpan(0, 0, 0, 0, connection.getConnectionTimeout());
                    _TimedOut       = false;

                    // Set the delegate to be notified of a timeout
                    _Timer.Tick += delegate
                    {
                        _TimedOut = true;
                        _Timer.Stop();
                        if (EXCallback != null)
                        {
                            connection.syncContext.Send(new SendOrPostCallback(x => EXCallback.DynamicInvoke(new DBXException("Request timed out."))), null);
                        }
                    };
                }
                catch
                {
                    _Timer    = null;
                    _TimedOut = false;
                }
            }
예제 #2
0
            protected HTTPExecutor(DSRESTConnection connection, HttpWebRequest Client, DSRESTCommand command, DSAdmin Sender, Delegate callback, Delegate EXCallback)
            {
                this.connection = connection;
                this.Client     = Client;
                this.command    = command;
                this.Sender     = Sender;
                this.callback   = callback;
                this.EXCallback = EXCallback;
                this._TimedOut  = false;
                this._Timer     = null;

                //don't enable timeout if the request is for a heavyweight callback. Heavyweight callbacks should be timed out
                //with custom code, which uses a call to close the channel with the server when the timeout happens.
                if (connection.getConnectionTimeout() > 0 && !isHeavyweightCallbackRequest(Client))
                {
                    connection.syncContext.Send(new SendOrPostCallback(x => initTimer()), null);
                }
            }
예제 #3
0
            protected HTTPExecutor(DSRESTConnection connection, HttpWebRequest Client, DSRESTCommand command, DSAdmin Sender, Delegate callback, Delegate EXCallback)
            {
                this.connection = connection;
                this.Client = Client;
                this.command = command;
                this.Sender = Sender;
                this.callback = callback;
                this.EXCallback = EXCallback;
                this._TimedOut = false;
                this._Timer = null;

                //don't enable timeout if the request is for a heavyweight callback. Heavyweight callbacks should be timed out
                //with custom code, which uses a call to close the channel with the server when the timeout happens.
                if (connection.getConnectionTimeout() > 0 && !isHeavyweightCallbackRequest(Client))
                {
                    connection.syncContext.Send(new SendOrPostCallback(x => initTimer()), null);
                }
            }