Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/SagerNet/sing-tun into meta
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Apr 2, 2024
2 parents 5d2b354 + cddf605 commit 0223b8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions monitor_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ func (m *defaultInterfaceMonitor) Start() error {
}

func (m *defaultInterfaceMonitor) delayCheckUpdate() {
if m.checkUpdateTimer != nil {
m.checkUpdateTimer.Stop()
if m.checkUpdateTimer == nil {
m.checkUpdateTimer = time.AfterFunc(time.Second, m.postCheckUpdate)
} else {
m.checkUpdateTimer.Reset(time.Second)
}
m.checkUpdateTimer = time.AfterFunc(time.Second, m.postCheckUpdate)
}

func (m *defaultInterfaceMonitor) postCheckUpdate() {
Expand Down
4 changes: 3 additions & 1 deletion tun_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ func (t *NativeTun) BatchSize() int {
if !t.gsoEnabled {
return 1
}
/* // Not works on some devices: https://github.com/SagerNet/sing-box/issues/1605
batchSize := int(gsoMaxSize/t.options.MTU) * 2
if batchSize > idealBatchSize {
batchSize = idealBatchSize
}
return batchSize
return batchSize*/
return idealBatchSize
}

func (t *NativeTun) BatchRead(buffers [][]byte, offset int, readN []int) (n int, err error) {
Expand Down

0 comments on commit 0223b8b

Please sign in to comment.