Skip to content

Commit

Permalink
Add quick logic for scheduler to send fake packet when no buffer is p…
Browse files Browse the repository at this point in the history
…ending
  • Loading branch information
yuhan6665 committed Sep 4, 2024
1 parent 68d3952 commit a8f0c9f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions proxy/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<sending; i++ {
s.Error <- s.writer.WriteMultiBuffer(<-s.Buffer)
for i := 0; i<sending; i++ {
s.Error <- s.writer.WriteMultiBuffer(<-s.Buffer)
}
} else if trigger > 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()
}()
Expand All @@ -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
}
}

0 comments on commit a8f0c9f

Please sign in to comment.