From b7c6ff1676a4ed9e4f4a69c0e249d0891e031f5e Mon Sep 17 00:00:00 2001 From: Subodh Iyengar Date: Fri, 10 May 2019 15:55:50 -0700 Subject: [PATCH] Remove redundant check for ack state empty Summary: removes the redundant check for ack states empty Reviewed By: yangchi Differential Revision: D15299534 fbshipit-source-id: c427b37987247dc4a4e11281464bc13f8645974c --- quic/api/QuicPacketScheduler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quic/api/QuicPacketScheduler.cpp b/quic/api/QuicPacketScheduler.cpp index c8dcd1a16..5125dba27 100644 --- a/quic/api/QuicPacketScheduler.cpp +++ b/quic/api/QuicPacketScheduler.cpp @@ -33,14 +33,15 @@ quic::StreamFrameMetaData makeStreamFrameMetaDataFromStreamBuffer( namespace quic { bool hasAcksToSchedule(const AckState& ackState) { - if (ackState.acks.empty()) { + folly::Optional largestAckSend = largestAckToSend(ackState); + if (!largestAckSend) { return false; } if (!ackState.largestAckScheduled) { // Never scheduled an ack, we need to send return true; } - return *largestAckToSend(ackState) > *(ackState.largestAckScheduled); + return *largestAckSend > *(ackState.largestAckScheduled); } bool neverWrittenAcksBefore(const QuicConnectionStateBase& conn) {