public virtual void Unregister(UnregisterInfo unregisterInfo)
{
if (unregisterInfo == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo"));
}
this.ThrowIfClosed("Unregister");
if ((!unregisterInfo.HasBody() || string.IsNullOrEmpty(unregisterInfo.MeshId)) || (unregisterInfo.RegistrationId == Guid.Empty))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo }));
}
RegistrationEntry entry = null;
MeshEntry meshEntry = this.GetMeshEntry(unregisterInfo.MeshId, false);
LiteLock liteLock = null;
try
{
LiteLock.Acquire(out liteLock, meshEntry.Gate, true);
if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out entry))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo }));
}
meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId);
meshEntry.EntryList.Remove(entry);
meshEntry.Service2EntryTable.Remove(entry.Address.ServicePath);
entry.State = RegistrationState.Deleted;
}
finally
{
LiteLock.Release(liteLock);
}
}