/// <summary> /// Initializes a new instance of the <see cref="MessageContext"/> class. /// </summary> protected MessageContext() { this._socketContext = new SocketAsyncEventArgs(); this._socketContext.UserToken = this; this._timeoutWatcher = new TimeoutWatcher(); this._timeoutWatcher.Timeout += (sender, e) => this.OnTimeout(); }
/// <summary> /// Initializes a new instance of the <see cref="MessageContext"/> class. /// </summary> protected MessageContext() { SocketContext = new SocketAsyncEventArgs { UserToken = this }; timeoutWatcher = new TimeoutWatcher(); timeoutWatcher.Timeout += (sender, e) => OnTimeout(); }
public DefaultConnectTimeoutWatcher(TimeSpan timeout, Action onTimeout) { var watcher = new TimeoutWatcher(); watcher.Timeout += (sender, e) => onTimeout(); Interlocked.Exchange(ref this._watcher, watcher); watcher.Start(timeout); }
/// <summary> /// Initializes a new instance of the <see cref="MessageContext"/> class. /// </summary> protected MessageContext() { this._socketContext = new SocketAsyncEventArgs(); this._socketContext.UserToken = this; this._timeoutWatcher = new TimeoutWatcher(); this._timeoutWatcher.Timeout += ( sender, e ) => this.OnTimeout(); }
public DefaultConnectTimeoutWatcher( TimeSpan timeout, Action onTimeout ) { var watcher = new TimeoutWatcher(); watcher.Timeout += ( sender, e ) => onTimeout(); Interlocked.Exchange( ref this._watcher, watcher ); watcher.Start( timeout ); }