private void OnAck(int channelID, long seqNo, long sentTime) { ////Log.Error("====================OnAck detail: channelID: " + channelID + " seqNo: " + seqNo + " sentTime:" + sentTime); UdpPackage[] pkgArr; if (pkgMatrix.TryGetValue(channelID, out pkgArr)) { ChannelInfo cInfo = channelArr[channelID]; if (cInfo.InRange(seqNo)) { if (sentTime == 0) { SetAllAckBack(channelID, seqNo); } else { UdpPackage pkg = pkgArr[SeqnoIdx(seqNo)]; if (!pkg.isAckBack) { pkg.SetAckBacked(sentTime); } SetLostFlag(cInfo, pkgArr, seqNo, sentTime); } AssignSeqno(channelID, seqNo); } } }
private void SetAllAckBack(int channelID, long seqNoRecved) { ChannelInfo channel = channelArr[channelID]; if (channel.Empty()) { return; //当前channel为空的 } UdpPackage[] pkgs = pkgMatrix[channelID]; for (long seqIdx = (maxSeqnoRecved - 1); seqIdx >= channel.firstSeqno; seqIdx--) { UdpPackage pkg = pkgs[SeqnoIdx(seqIdx)]; if (pkg != null && !pkg.isAckBack) { pkg.SetAckBacked(0); } } channel.firstSeqno = seqNoRecved; }