Ejemplo n.º 1
0
        /// <summary>
        /// Method to send an association abort PDU.
        /// </summary>
        /// <param name="source">The source of the abort.</param>
        /// <param name="reason">The reason for the abort.</param>
        public void SendAssociateAbort(DicomAbortSource source, DicomAbortReason reason)
        {
            if (State != DicomAssociationState.Sta13_AwaitingTransportConnectionClose)
            {
                var pdu = new AAbort(source, reason);

                EnqueuePdu(pdu.Write());
                State = DicomAssociationState.Sta13_AwaitingTransportConnectionClose;

                if (AssociationAborted != null)
                    AssociationAborted(_assoc, reason);
            }
            else
            {
                Platform.Log(LogLevel.Error, "Unexpected state for association abort, closing connection from {0} to {1}",
                                     _assoc.CallingAE, _assoc.CalledAE);

				OnNetworkError(null, true);

                if (NetworkClosed != null)
                    NetworkClosed("Unexpected state for association abort");
            }
        }