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