示例#1
0
        // For polling transports in a situation when in the message callback,
        // new message is being send. If the sending connection was started
        // before receiving one, it is possible to saturate the network and
        // timeout due to the lack of receiving socket. To avoid that we delay
        // sending messages by some small time, in order to let receiving
        // connection be started beforehand. This is only a halfmeasure and
        // does not fix the big problem, but it does make the tests go more
        // stable on slow networks.
        private void SendScheduleWait()
        {
            Log.Debug(nameof(this.SendScheduleWait));
            int? tref = null;
            this._sendStop = () =>
            {
                Log.Debug("SendStop");
                this._sendStop = null;
                Timers.ClearInterval(tref);
            };

            tref = Timers.SetTimeout(() =>
            {
                Log.Debug("Timeout");
                this._sendStop = null;
                this.SendSchedule();
            }, 25);
        }