Skip to content

Commit

Permalink
Experiment: seed ignore buffer and send 1st fake packet instantly
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhan6665 committed Sep 4, 2024
1 parent 9c574fd commit 7d7a447
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion proxy/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func NewScheduler(w buf.Writer, addon *Addons, state *TrafficState, context cont
}
go s.mainLoop()
if s.addons.Scheduler != nil {
if buffered, ok := w.(*buf.BufferedWriter); ok {
buffered.SetBuffered(false)
}
go s.exampleIndependentScheduler()
}
return &s
Expand Down Expand Up @@ -72,7 +75,7 @@ func(s *Scheduler) mainLoop() {

func(s *Scheduler) exampleIndependentScheduler() {
for {
time.Sleep(500 * time.Millisecond)
s.Trigger <- 1 // send fake buffer if no pending
time.Sleep(500 * time.Millisecond)
}
}
10 changes: 5 additions & 5 deletions proxy/vless/encoding/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ func PopulateSeed(seed string, addons *proxy.Addons) {
LongMin: 900,
LongMax: 1400,
}
addons.Delay = &proxy.DelayConfig{
IsRandom: true,
MinMillis: 100,
MaxMillis: 500,
}
// addons.Delay = &proxy.DelayConfig{
// IsRandom: true,
// MinMillis: 100,
// MaxMillis: 500,
// }
addons.Scheduler = &proxy.SchedulerConfig{
TimeoutMillis: 600,
}
Expand Down

0 comments on commit 7d7a447

Please sign in to comment.