/// <summary> /// Initializes a new instance of the <see cref="HangingRequestDisconnectEventArgs"/> class. /// </summary> /// <param name="reason">The reason.</param> /// <param name="exception">The exception.</param> internal HangingRequestDisconnectEventArgs( HangingRequestDisconnectReason reason, Exception exception) { this.Reason = reason; this.Exception = exception; }
/// <summary> /// Disconnects the request with the specified reason and exception. /// </summary> /// <param name="reason">The reason.</param> /// <param name="exception">The exception.</param> internal void Disconnect(HangingRequestDisconnectReason reason, Exception exception) { if (this.IsConnected) { this.response.Close(); this.InternalOnDisconnect(reason, exception); } }
/// <summary> /// Perform any bookkeeping needed when we disconnect (cleanly or forcefully) /// </summary> /// <param name="reason"></param> /// <param name="exception"></param> private void InternalOnDisconnect(HangingRequestDisconnectReason reason, Exception exception) { if (this.IsConnected) { this.IsConnected = false; this.OnDisconnect( this, new HangingRequestDisconnectEventArgs(reason, exception)); } }