/// <summary> /// 缓存输出包 /// </summary> /// <param name="outPacket">The out packet.</param> public void PutSent(OutPacket outPacket) { if (parsers[outPacket.GetFamily()] != null) { PacketHistory history = parsers[outPacket.GetFamily()].GetHistory(); if (history != null) { history.PutSent(outPacket); } } }
/// <summary> /// 这个方法检查包是否已收到,要注意的是检查是针对这个包的hash值进行的, /// * 并不是对packet这个对象,hash值的计算是在packet的hashCode中完成的, /// * 如果两个packet的序号或者命令有不同,则hash值肯定不同。 /// </summary> /// <param name="packet">The packet.</param> /// <param name="add">if set to <c>true</c> [add].如果为true,则当这个包不存在时,添加这个包的hash,否则不添加</param> /// <returns>true如果这个包已经收到,否则false</returns> public bool IsReplied(OutPacket packet, bool add) { if (parsers[packet.GetFamily()] != null) { PacketHistory history = parsers[packet.GetFamily()].GetHistory(); if (history != null) { return(history.Check(packet, add)); } else { return(false); } } return(false); }