public void UpdateServerAdvertisement(IGluonSession session, AdvertiseCapacity request) { lock (Servers) { var state = GetState(session); if (state == null) { state = new LotServerState { Session = session }; Servers.Add(state); if (ServersByCallsign.ContainsKey(session.CallSign)) { ServersByCallsign[session.CallSign] = state; } else { ServersByCallsign.Add(session.CallSign, state); } } state.Session = session; //can be hot-swapped if we re-establish connection. TODO: verify and look for race conditions state.MaxLots = request.MaxLots; state.CurrentLots = request.CurrentLots; state.CpuPercentAvg = request.CpuPercentAvg; state.RamAvaliable = request.RamAvaliable; state.RamUsed = request.RamUsed; } }
public IGluonSession GetLotServerSession(string callSign) { lock (Servers) { IGluonSession result = null; LotServerState state = null; if (ServersByCallsign.TryGetValue(callSign, out state)) { result = state.Session; } return(result); } }
public LotPickerAttempt(LotServerState state) { this.State = state; }