public HiveConnectionRecord Clone() { HiveConnectionRecord newRecord = new HiveConnectionRecord(); newRecord.ServerInfo = ServerInfo; newRecord.RemoteEndPoint = RemoteEndPoint; return newRecord; }
public void AddOrUpdateRecord(HiveConnectionRecord item) { lock (records.SyncLock) { if (Contains(item.ServerInfo.ServerId)) Remove(item.ServerInfo.ServerId); Add(item); } }
public void Add(HiveConnectionRecord item) { if (item.ServerInfo == null) throw new InvalidOperationException("Invalid HiveConnectionRecord: Reference must be supplied."); if (string.IsNullOrEmpty(item.ServerInfo.ServerId)) throw new InvalidOperationException("Invalid HiveConnectionRecord: ServerId must be supplied."); if (item.RemoteEndPoint == null) throw new InvalidOperationException("Invalid ConnectionRecord: RemoteEndPoint must be supplied."); if (string.IsNullOrEmpty(item.RemoteEndPoint.Address.ToString())) throw new InvalidOperationException("Invalid ConnectionRecord: PlayerEndPoint must be supplied."); lock (records.SyncLock) { if (Contains(item.ServerInfo.ServerId)) throw new InvalidOperationException("A particular Node cannot have more than one connection record in the connection tracker."); else records.Add(item); } }