public void RemoveOrThrow(TcpRoutingContext routingContext) { if (!routingContexts.TryRemove(routingContext)) { throw new InvalidStateException(); } }
public void AddOrThrow(TcpRoutingContext routingContext) { if (!routingContexts.TryAdd(routingContext)) { throw new InvalidStateException(); } }
public void UnassociateRemoteIdentityOrThrow(Guid remoteId, TcpRoutingContext routingContext) { clientRoutingContextsByClientId.RemoveOrThrow(remoteId, routingContext); }
public bool TryGetByRemoteId(Guid remoteId, out TcpRoutingContext routingContext) { return(clientRoutingContextsByClientId.TryGetValue(remoteId, out routingContext)); }