From 5314e4f9db0e23235ee93490c1828f501cb319ec Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Oct 26 2021 05:17:43 +0000 Subject: fix bugs --- diff --git a/tunnel.cpp b/tunnel.cpp index 81705b9..51be451 100644 --- a/tunnel.cpp +++ b/tunnel.cpp @@ -152,7 +152,7 @@ bool Tunnel::recvUdpPacket() { } if (i == connections.end()) { - DebugMsg("unknown connection: %u", id.id); + DebugMsg("unknown connection: %u", (id.address.print(), id.id)); if (cmd != CMD_TERM) termQueue.insert(id); return true; } diff --git a/udpsendqueue.cpp b/udpsendqueue.cpp index 7f07d4d..bac1ab9 100644 --- a/udpsendqueue.cpp +++ b/udpsendqueue.cpp @@ -163,14 +163,12 @@ bool UdpSendQueue::canSentToUdp() const void UdpSendQueue::whenWriteToUdp(Time &t) const { int size = connection.tcpRecvQueue.busySize(); - if (size >= PACKET_SIZE) { + if (busyFirst || size >= PACKET_SIZE) { if (timeLess(nextSendTime, t)) t = nextSendTime; - return; + } else + if (size > 0) { + Time tt = nextPartialSendTime; + if (timeLess(nextPartialSendTime, nextSendTime)) tt = nextSendTime; + if (timeLess(tt, t)) t = tt; } - - Time tt = t; - if (size > 0 && timeLess(nextPartialSendTime, tt)) tt = nextPartialSendTime; - if (busyFirst && timeLess(busyFirst->resendTime, tt)) tt = busyFirst->resendTime; - if (timeLess(tt, nextSendTime)) tt = nextSendTime; - if (timeLess(tt, t)) t = tt; }