/// <summary> /// ping网络 /// </summary> private void OnPingNet(PacketBase packet) { c2ss.PingNet msg = packet as c2ss.PingNet; if (Utils.HasFlag(msg.flags, (uint)eServerType.GLOBAL)) {//ping gl ss2gl.PingNet rep_msg = PacketPools.Get(ss2gl.msg.PING_NET) as ss2gl.PingNet; rep_msg.client_uid = msg.client_uid; rep_msg.packet_id = msg.packet_id; rep_msg.tick = msg.tick; rep_msg.flags = msg.flags; ServerNetManager.Instance.Send2GL(rep_msg); } else { long offset_time = Time.time - msg.tick; Log.Debug("收到第:" + msg.packet_id + " 时间:" + Time.time + " 延迟:" + offset_time); ss2c.PingNet rep_msg = PacketPools.Get(ss2c.msg.PING_NET) as ss2c.PingNet; rep_msg.packet_id = msg.packet_id; rep_msg.tick = msg.tick; rep_msg.flags = msg.flags; ServerNetManager.Instance.SendProxy(msg.client_uid, rep_msg); } }
public static void SendPingGL(uint packet_idx) { c2ss.PingNet msg = PacketPools.Get(c2ss.msg.PING_NET) as c2ss.PingNet; msg.packet_id = packet_idx; msg.tick = Time.time; msg.flags |= (uint)eServerType.GLOBAL; ClientNetManager.Instance.Send(msg); }
public static void SendPingSS(uint packet_idx) { c2ss.PingNet msg = PacketPools.Get(c2ss.msg.PING_NET) as c2ss.PingNet; msg.packet_id = packet_idx; msg.tick = Time.time; msg.flags = 0; ClientNetManager.Instance.Send(msg); }