private void Validate() { if ((this.address == null) || (this.binding == null)) { PeerExceptionHelper.ThrowArgument_InsufficientResolverSettings(); } }
void ThrowIfClosed(string operation) { if (!opened) { PeerExceptionHelper.ThrowInvalidOperation_NotValidWhenClosed(operation); } }
private void ThrowIfOpened(string operation) { if (this.opened) { PeerExceptionHelper.ThrowInvalidOperation_NotValidWhenOpen(operation); } }
public virtual RegisterResponseInfo Register(Guid clientId, string meshId, PeerNodeAddress address) { Guid registrationId = Guid.NewGuid(); DateTime expires = DateTime.UtcNow + this.RefreshInterval; RegistrationEntry entry = null; MeshEntry meshEntry = null; lock (this.ThisLock) { entry = new RegistrationEntry(clientId, registrationId, meshId, expires, address); meshEntry = this.GetMeshEntry(meshId); if (meshEntry.Service2EntryTable.ContainsKey(address.ServicePath)) { PeerExceptionHelper.ThrowInvalidOperation_DuplicatePeerRegistration(address.ServicePath); } LiteLock liteLock = null; try { LiteLock.Acquire(out liteLock, meshEntry.Gate, true); meshEntry.EntryTable.Add(registrationId, entry); meshEntry.EntryList.Add(entry); meshEntry.Service2EntryTable.Add(address.ServicePath, entry); } finally { LiteLock.Release(liteLock); } } return(new RegisterResponseInfo(registrationId, this.RefreshInterval)); }
void Validate() { if (address == null || binding == null) { PeerExceptionHelper.ThrowArgument_InsufficientResolverSettings(); } }
public virtual RegisterResponseInfo Register(Guid clientId, string meshId, PeerNodeAddress address) { Guid registrationId = Guid.NewGuid(); DateTime expiry = DateTime.UtcNow + RefreshInterval; RegistrationEntry entry = null; MeshEntry meshEntry = null; lock (ThisLock) { entry = new RegistrationEntry(clientId, registrationId, meshId, expiry, address); meshEntry = GetMeshEntry(meshId); if (meshEntry.Service2EntryTable.ContainsKey(address.ServicePath)) { PeerExceptionHelper.ThrowInvalidOperation_DuplicatePeerRegistration(address.ServicePath); } LiteLock ll = null; try { // meshEntry.gate can be held by this thread for write if this is coming from update // else MUST not be held at all. if (!meshEntry.Gate.IsWriterLockHeld) { LiteLock.Acquire(out ll, meshEntry.Gate, true); } meshEntry.EntryTable.Add(registrationId, entry); meshEntry.EntryList.Add(entry); meshEntry.Service2EntryTable.Add(address.ServicePath, entry); } finally { if (ll != null) { LiteLock.Release(ll); } } } return(new RegisterResponseInfo(registrationId, RefreshInterval)); }