public ErrorCode OnBSAskPing(NetSessionBase session, Google.Protobuf.IMessage message) { Protos.G_AskPing askPing = (Protos.G_AskPing)message; Protos.G_AskPingRet askPingRet = ProtoCreator.R_G_AskPing(askPing.Opts.Pid); askPingRet.Stime = askPing.Time; askPingRet.Time = TimeUtils.utcTime; session.Send(askPingRet); return(ErrorCode.Success); }
public ErrorCode OnGSAskPing(NetSessionBase session, IMessage message) { Protos.G_AskPing request = (Protos.G_AskPing)message; Protos.G_AskPingRet response = ProtoCreator.R_G_AskPing(request.Opts.Pid); response.Stime = request.Time; response.Time = TimeUtils.utcTime; session.Send(response); return(ErrorCode.Success); }
private static void OnCSAskPingRet(NetSessionBase session, Google.Protobuf.IMessage message, object[] args) { long currTime = TimeUtils.utcTime; Protos.G_AskPingRet askPingRet = (Protos.G_AskPingRet)message; long lag = ( long )((currTime - askPingRet.Stime) * 0.5); long timeDiff = askPingRet.Time + lag - currTime; Logger.Log($"cs ping ret, lag:{lag}, timediff:{timeDiff}"); }