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");
}
}