public void NotifyClients(uint sessionId, ServerInfoBase info) { var serverName = ""; if (info is WorldServerInfo) serverName = "WorldServer"; else if (info is WorldNodeInfo) serverName = "NodeServer"; if (info == null) { if (Servers.TryRemove(sessionId, out info)) Log.Debug($"{serverName} (Realm: {info.RealmId}, Host: {info.IPAddress}, Port: {info.Port}) disconnected."); } else { var status = "connected"; if (Servers.ContainsKey(sessionId)) status = "updated"; Servers.AddOrUpdate(sessionId, info, (k, v) => info); Log.Debug($"{serverName} (Host: {info.IPAddress}, Port: {info.Port}, Connections: {info.ActiveConnections}) {status}."); } }
public void Update(ServerInfoBase info) { foreach (var s in Servers) { if (s.Value.Compare(info)) { info.SessionId = s.Key; Servers[s.Key] = info; NotifyClients(info.SessionId, info); break; } } }
public void NotifyClients(uint sessionId, ServerInfoBase info) { if (info == null) { IServiceCallback dummy; clients.TryRemove(sessionId, out dummy); foreach (var c in clients) c.Value.NotifyClients(sessionId, null); } else { foreach (var c in clients) c.Value.NotifyClients(sessionId, info); } }
public void Register(ServerInfoBase info) { if (info != null) { if (info.SessionId == 0) info.SessionId = LastSessionId; Servers.AddOrUpdate(info.SessionId, (WorldNodeInfo)info, (k, v) => (WorldNodeInfo)info); NotifyClients(info.SessionId, info); } else { var callback = OperationContext.Current.GetCallbackChannel<IServiceCallback>(); clients.AddOrUpdate(LastSessionId, callback, (k, v) => callback); } }
public bool Compare(ServerInfoBase info) { return RealmId == info.RealmId && IPAddress == info.IPAddress && Port == info.Port; }
public void Update(ServerInfoBase info) { proxy.Update(info); }
public void Register(ServerInfoBase info) { proxy.Register(info); }