From c0619e390afa59fdf86ad0163aea3953a0e1c322 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Mon, 1 Jul 2024 21:27:24 -0400 Subject: [PATCH] Add quick logic for scheduler to send fake packet when no buffer is pending --- proxy/scheduler.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/proxy/scheduler.go b/proxy/scheduler.go index 70a491f8..dec1f4be 100644 --- a/proxy/scheduler.go +++ b/proxy/scheduler.go @@ -57,9 +57,13 @@ func(s *Scheduler) mainLoop() { var sending = len(s.Buffer) if sending > 0 { errors.LogDebug(s.ctx, "Scheduler Trigger for ", sending, " buffer(s) with ", d, " ", trigger) - } - for i := 0; i 0 { + errors.LogDebug(s.ctx, "Scheduler Trigger for fake buffer with ", d, " ", trigger) + mb := make(buf.MultiBuffer, 1) + s.Error <- s.writer.WriteMultiBuffer(mb) } s.bufferReadLock.Unlock() }() @@ -69,6 +73,6 @@ func(s *Scheduler) mainLoop() { func(s *Scheduler) exampleIndependentScheduler() { for { time.Sleep(500 * time.Millisecond) - s.Trigger <- -1 // send all buffers + s.Trigger <- 1 // send fake buffer if no pending } }