@@ -9532,65 +9532,81 @@ bool srt::CUDT::packUniqueData(CPacket& w_packet, time_point& w_origintime)
9532
9532
9533
9533
// A CHANGE. The sequence number is currently added to the packet
9534
9534
// when scheduling, not when extracting. This is a inter-migration form,
9535
-
// so still override the value, but trace it.
9535
+
// only override extraction sequence with scheduling sequence in group mode.
9536
9536
m_iSndCurrSeqNo = CSeqNo::incseq(m_iSndCurrSeqNo);
9537
9537
9538
-
// Do this checking only for groups and only at the very first moment,
9539
-
// when there's still nothing in the buffer. Otherwise there will be
9540
-
// a serious data discrepancy between the agent and the peer.
9541
-
// After increasing by 1, but being previously set as ISN-1, this should be == ISN,
9542
-
// if this is the very first packet to send.
9543
9538
#if ENABLE_EXPERIMENTAL_BONDING
9544
-
// Fortunately here is only the procedure that verifies if the extraction
9545
-
// sequence is moved due to the difference between ISN caught during the existing
9546
-
// transmission and the first sequence possible to be used at the first sending
9547
-
// instruction. The group itself isn't being accessed.
9548
-
if (m_parent->m_GroupOf && m_iSndCurrSeqNo != w_packet.m_iSeqNo && m_iSndCurrSeqNo == m_iISN)
9549
-
{
9550
-
const int packetspan = CSeqNo::seqcmp(w_packet.m_iSeqNo, m_iSndCurrSeqNo);
9551
-
9552
-
HLOGC(qslog.Debug, log << CONID() << "packData: Fixing EXTRACTION sequence " << m_iSndCurrSeqNo
9553
-
<< " from SCHEDULING sequence " << w_packet.m_iSeqNo
9554
-
<< " DIFF: " << packetspan << " STAMP:" << BufferStamp(w_packet.m_pcData, w_packet.getLength()));
9555
-
9556
-
// This is the very first packet to be sent; so there's nothing in
9557
-
// the sending buffer yet, and therefore we are in a situation as just
9558
-
// after connection. No packets in the buffer, no packets are sent,
9559
-
// no ACK to be awaited. We can screw up all the variables that are
9560
-
// initialized from ISN just after connection.
9561
-
//
9562
-
// Additionally send the drop request to the peer so that it
9563
-
// won't stupidly request the packets to be retransmitted.
9564
-
// Don't do it if the difference isn't positive or exceeds the threshold.
9539
+
// Fortunately the group itself isn't being accessed.
9540
+
if (m_parent->m_GroupOf)
9541
+
{
9542
+
const int packetspan = CSeqNo::seqoff(m_iSndCurrSeqNo, w_packet.m_iSeqNo);
9565
9543
if (packetspan > 0)
9566
9544
{
9567
-
int32_t seqpair[2];
9568
-
seqpair[0] = m_iSndCurrSeqNo;
9569
-
seqpair[1] = w_packet.m_iSeqNo;
9570
-
HLOGC(qslog.Debug, log << "... sending INITIAL DROP (ISN FIX): "
9571
-
<< "msg=" << MSGNO_SEQ::unwrap(w_packet.m_iMsgNo) << " SEQ:"
9572
-
<< seqpair[0] << " - " << seqpair[1] << "(" << packetspan << " packets)");
9573
-
sendCtrl(UMSG_DROPREQ, &w_packet.m_iMsgNo, seqpair, sizeof(seqpair));
9545
+
// After increasing by 1, but being previously set as ISN-1, this should be == ISN,
9546
+
// if this is the very first packet to send.
9547
+
if (m_iSndCurrSeqNo == m_iISN)
9548
+
{
9549
+
// This is the very first packet to be sent; so there's nothing in
9550
+
// the sending buffer yet, and therefore we are in a situation as just
9551
+
// after connection. No packets in the buffer, no packets are sent,
9552
+
// no ACK to be awaited. We can screw up all the variables that are
9553
+
// initialized from ISN just after connection.
9554
+
LOGC(qslog.Note,
9555
+
log << CONID() << "packData: Fixing EXTRACTION sequence " << m_iSndCurrSeqNo
9556
+
<< " from SCHEDULING sequence " << w_packet.m_iSeqNo << " for the first packet: DIFF="
9557
+
<< packetspan << " STAMP=" << BufferStamp(w_packet.m_pcData, w_packet.getLength()));
9558
+
}
9559
+
else
9560
+
{
9561
+
// There will be a serious data discrepancy between the agent and the peer.
9562
+
LOGC(qslog.Error,
9563
+
log << CONID() << "IPE: packData: Fixing EXTRACTION sequence " << m_iSndCurrSeqNo
9564
+
<< " from SCHEDULING sequence " << w_packet.m_iSeqNo << " in the middle of transition: DIFF="
9565
+
<< packetspan << " STAMP=" << BufferStamp(w_packet.m_pcData, w_packet.getLength()));
9566
+
}
9574
9567
9568
+
// Additionally send the drop request to the peer so that it
9569
+
// won't stupidly request the packets to be retransmitted.
9570
+
// Don't do it if the difference isn't positive or exceeds the threshold.
9571
+
int32_t seqpair[2];
9572
+
seqpair[0] = m_iSndCurrSeqNo;
9573
+
seqpair[1] = CSeqNo::decseq(w_packet.m_iSeqNo);
9574
+
const int32_t no_msgno = 0;
9575
+
LOGC(qslog.Debug,
9576
+
log << CONID() << "packData: Sending DROPREQ: SEQ: " << seqpair[0] << " - " << seqpair[1] << " ("
9577
+
<< packetspan << " packets)");
9578
+
sendCtrl(UMSG_DROPREQ, &no_msgno, seqpair, sizeof(seqpair));
9575
9579
// In case when this message is lost, the peer will still get the
9576
9580
// UMSG_DROPREQ message when the agent realizes that the requested
9577
9581
// packet are not present in the buffer (preadte the send buffer).
9582
+
9583
+
// Override extraction sequence with scheduling sequence.
9584
+
m_iSndCurrSeqNo = w_packet.m_iSeqNo;
9585
+
ScopedLock ackguard(m_RecvAckLock);
9586
+
m_iSndLastAck = w_packet.m_iSeqNo;
9587
+
m_iSndLastDataAck = w_packet.m_iSeqNo;
9588
+
m_iSndLastFullAck = w_packet.m_iSeqNo;
9589
+
m_iSndLastAck2 = w_packet.m_iSeqNo;
9590
+
}
9591
+
else if (packetspan < 0)
9592
+
{
9593
+
LOGC(qslog.Error,
9594
+
log << CONID() << "IPE: packData: SCHEDULING sequence " << w_packet.m_iSeqNo
9595
+
<< " is behind of EXTRACTION sequence " << m_iSndCurrSeqNo << ", dropping this packet: DIFF="
9596
+
<< packetspan << " STAMP=" << BufferStamp(w_packet.m_pcData, w_packet.getLength()));
9597
+
// XXX: Probably also change the socket state to broken?
9598
+
return false;
9578
9599
}
9579
9600
}
9580
9601
else
9581
9602
#endif
9582
9603
{
9583
-
HLOGC(qslog.Debug, log << CONID() << "packData: Applying EXTRACTION sequence " << m_iSndCurrSeqNo
9584
-
<< " over SCHEDULING sequence " << w_packet.m_iSeqNo
9585
-
<< " DIFF: " << CSeqNo::seqcmp(m_iSndCurrSeqNo, w_packet.m_iSeqNo)
9586
-
<< " STAMP:" << BufferStamp(w_packet.m_pcData, w_packet.getLength()));
9587
-
9588
-
#if ENABLE_EXPERIMENTAL_BONDING
9589
-
HLOGC(qslog.Debug, log << "... CONDITION: IN GROUP: " << (m_parent->m_GroupOf ? "yes":"no")
9590
-
<< " extraction-seq=" << m_iSndCurrSeqNo << " scheduling-seq=" << w_packet.m_iSeqNo << " ISN=" << m_iISN);
9591
-
#endif
9592
-
9593
-
// Do this always when not in a group,
9604
+
HLOGC(qslog.Debug,
9605
+
log << CONID() << "packData: Applying EXTRACTION sequence " << m_iSndCurrSeqNo
9606
+
<< " over SCHEDULING sequence " << w_packet.m_iSeqNo << " for socket not in group:"
9607
+
<< " DIFF=" << CSeqNo::seqcmp(m_iSndCurrSeqNo, w_packet.m_iSeqNo)
9608
+
<< " STAMP=" << BufferStamp(w_packet.m_pcData, w_packet.getLength()));
9609
+
// Do this always when not in a group.
9594
9610
w_packet.m_iSeqNo = m_iSndCurrSeqNo;
9595
9611
}
9596
9612
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4