Skip to content

Commit 2a0c752

Browse files
committed
tcp,udp,icmp: account for kotlin-side variance for flow timeouts
1 parent 7c0bcbd commit 2a0c752

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

intra/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (h *baseHandler) onInflow(to, from netip.AddrPort) (fm *Mark) {
119119
// inflow does not go through nat/alg/dns/proxy
120120
fm, ok := core.Grx(h.proto+".inflow", func(_ context.Context) (*Mark, error) {
121121
return h.listener.Inflow(nn, int32(uid), to.String(), from.String()), nil
122-
}, onFlowTimeout)
122+
}, onInFlowTimeout)
123123

124124
if !ok || fm == nil {
125125
fm = optionsBlock // fail-safe: block everything
@@ -172,7 +172,7 @@ func (h *baseHandler) onFlow(localaddr, target netip.AddrPort) (fm *Mark, undidA
172172

173173
pre, _ := core.Grx(h.proto+".preflow", func(_ context.Context) (*PreMark, error) {
174174
return h.listener.Preflow(proto, int32(uid), src, dst), nil
175-
}, onFlowTimeout)
175+
}, onPreFlowTimeout)
176176

177177
hasPre := pre != nil
178178
if hasPre && pre != nil /*nilaway*/ && len(pre.UID) > 0 {

intra/tcp.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,12 @@ type ioinfo struct {
9393
}
9494

9595
const (
96-
retryTimeout = 15 * time.Second
97-
onFlowTimeout = 5 * time.Second
96+
retryTimeout = 15 * time.Second
97+
98+
// onFlowTimeout takes in to account "testWithBackoff" on Kolin side (which is around 9s)
99+
onFlowTimeout = 10 * time.Second
100+
onPreFlowTimeout = 5 * time.Second
101+
onInFlowTimeout = 5 * time.Second
98102
)
99103

100104
var (

0 commit comments

Comments
 (0)