From 6dffd97f6406e76ac2a61458dd06dc64d028cc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9D=92=E9=98=B3?= Date: Fri, 28 May 2021 11:41:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E6=A8=A1=E6=8B=9F=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test.h b/test.h index b40e3cc6..1160a55b 100644 --- a/test.h +++ b/test.h @@ -194,11 +194,19 @@ class LatencySimulator IUINT32 delay = rttmin; if (rttmax > rttmin) delay += rand() % (rttmax - rttmin); pkt->setts(current + delay); - if (peer == 0) { - p12.push_back(pkt); - } else { - p21.push_back(pkt); - } + DelayTunnel *tunnel; + if (peer == 0) { + tunnel = &p12; + }else{ + tunnel = &p21; + } + auto iter = tunnel->crbegin(); + for(;iter != tunnel->crend(); ++iter){ + if((*iter)->ts() <= pkt->ts()){ + break; + } + } + tunnel->insert(iter.base(), pkt); } // 接收数据