From e038c51e0fa7633674675b2360e3b498f84140c6 Mon Sep 17 00:00:00 2001 From: WeidiDeng Date: Fri, 28 Jun 2024 16:33:59 +0800 Subject: [PATCH] fix prefetch --- layer4/routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layer4/routes.go b/layer4/routes.go index dea307e..5cd04ec 100644 --- a/layer4/routes.go +++ b/layer4/routes.go @@ -125,7 +125,7 @@ func (routes RouteList) Compile(logger *zap.Logger, matchingTimeout time.Duratio for { // only prefetch is needed, it's useful in case a RouteList in another RouteList cases // if some matchers returned ErrConsumedAllPrefetchedBytes, it's true anyway - if len(cx.buf) == 0 || len(cx.buf) == cx.offset { + if len(cx.buf) == 0 || len(cx.buf[cx.offset:]) == 0 { err = cx.prefetch() if err != nil { logFunc := logger.Error