private void Probe(string name) { var log = LogManager.GetLogger(Global.CallerName()); log.Info(string.Format("Probe probing transport '{0}'", name)); PriorWebsocketSuccess = false; var transport = CreateTransport(name); var parameters = new ProbeParameters { Transport = ImmutableList<Transport>.Empty.Add(transport), Failed = ImmutableList<bool>.Empty.Add(false), Cleanup = ImmutableList<Action>.Empty, Socket = this }; var onTransportOpen = new OnTransportOpenListener(parameters); var freezeTransport = new FreezeTransportListener(parameters); // Handle any error that happens while probing var onError = new ProbingOnErrorListener(this, parameters.Transport, freezeTransport); var onTransportClose = new ProbingOnTransportCloseListener(onError); // When the socket is closed while we're probing var onClose = new ProbingOnCloseListener(onError); var onUpgrade = new ProbingOnUpgradeListener(freezeTransport, parameters.Transport); parameters.Cleanup = parameters.Cleanup.Add(() => { if (parameters.Transport.Count < 1) { return; } parameters.Transport[0].Off(Transport.EVENT_OPEN, onTransportOpen); parameters.Transport[0].Off(Transport.EVENT_ERROR, onError); parameters.Transport[0].Off(Transport.EVENT_CLOSE, onTransportClose); Off(EVENT_CLOSE, onClose); Off(EVENT_UPGRADING, onUpgrade); }); parameters.Transport[0].Once(Transport.EVENT_OPEN, onTransportOpen); parameters.Transport[0].Once(Transport.EVENT_ERROR, onError); parameters.Transport[0].Once(Transport.EVENT_CLOSE, onTransportClose); this.Once(EVENT_CLOSE, onClose); this.Once(EVENT_UPGRADING, onUpgrade); parameters.Transport[0].Open(); }
private void Probe(string name) { var log = LogManager.GetLogger(Global.CallerName()); log.Info(string.Format("Probe probing transport '{0}'", name)); PriorWebsocketSuccess = false; var transport = CreateTransport(name); var parameters = new ProbeParameters { Transport = new List <Transport>() { transport }, Failed = new List <bool>() { false }, Cleanup = new List <Action>(), Socket = this }; var onTransportOpen = new OnTransportOpenListener(parameters); var freezeTransport = new FreezeTransportListener(parameters); // Handle any error that happens while probing var onError = new ProbingOnErrorListener(this, parameters.Transport, freezeTransport); var onTransportClose = new ProbingOnTransportCloseListener(onError); // When the socket is closed while we're probing var onClose = new ProbingOnCloseListener(onError); var onUpgrade = new ProbingOnUpgradeListener(freezeTransport, parameters.Transport); parameters.Cleanup.Add(() => { if (parameters.Transport.Count < 1) { return; } parameters.Transport[0].Off(Transport.EVENT_OPEN, onTransportOpen); parameters.Transport[0].Off(Transport.EVENT_ERROR, onError); parameters.Transport[0].Off(Transport.EVENT_CLOSE, onTransportClose); Off(EVENT_CLOSE, onClose); Off(EVENT_UPGRADING, onUpgrade); }); parameters.Transport[0].Once(Transport.EVENT_OPEN, onTransportOpen); parameters.Transport[0].Once(Transport.EVENT_ERROR, onError); parameters.Transport[0].Once(Transport.EVENT_CLOSE, onTransportClose); this.Once(EVENT_CLOSE, onClose); this.Once(EVENT_UPGRADING, onUpgrade); parameters.Transport[0].Open(); }
public ProbingOnTransportCloseListener(ProbingOnErrorListener onError) { this._onError = onError; }
public ProbingOnCloseListener(ProbingOnErrorListener onError) { this._onError = onError; }