public void Pong(Guid clientId, ServerEventHandler callback) { Error error = new Error(); error.Code = StatusCode.OK; m_job.Submit(() => { Thread.Sleep(400); return(null); }, result => { callback(error); RTTInfo rttInfo = m_pingTimer.Pong(clientId, () => { OnPong(error); }); m_pingTimer.Ping(clientId); if (Ping != null) { Ping(error, rttInfo); } }); }
public void Pong(Guid clientId, ServerEventHandler callback) { Error error = new Error(StatusCode.OK); if (!m_clientIdToPlayers.ContainsKey(clientId)) { error.Code = StatusCode.NotRegistered; callback(error); return; } callback(error); if (m_botControlManager != null) { m_botControlManager.Ping(clientId); } RTTInfo rttInfo = m_pingTimer.Pong(clientId, () => OnPingPongCompleted(error, clientId)); m_pingTimer.Ping(clientId); if (Ping != null) { m_pingArgs.Arg = rttInfo; m_pingArgs.Targets = new[] { clientId }; Ping(error, m_pingArgs); } }