void HandleCmdPing(HttpListenerRequest req, HttpListenerResponse res) { // Yes reaching up this far is shit :( if (!HFTGameManager.GetInstance().HaveGame()) { res.StatusCode = (int)HttpStatusCode.NotFound; } m_webServerUtils.SendJsonBytes(res, m_ping); }
protected override void OnOpen() { log_.Info("open"); try { HFTGameManager.GetInstance().AddPlayer(this); } catch (System.Exception ex) { log_.Error(ex.StackTrace); } }
void HandleCmdPing(HttpListenerRequest req, HttpListenerResponse res) { // Yes reaching up this far is shit :( if (!HFTGameManager.GetInstance().HaveGame()) { res.ContentType = "application/json"; res.StatusCode = (int)HttpStatusCode.BadRequest; res.WriteContent(System.Text.Encoding.UTF8.GetBytes("{\"error\":\"game not ready:\"}")); } else { m_webServerUtils.SendJsonBytes(res, m_ping); } }
public void StopListening() { // It's not clear to me where this belongs. Ideally I'd like to pass in the HFTGameManager // but how to pass it to new connections I have no idea. HFTGameManager.GetInstance().Close(); }