TUN-8158: Bring back commit e653741885 and fixes infinite loop on linux when the socket is closed

This commit is contained in:
chungthuang
2024-01-15 16:49:17 +00:00
parent f75503bf3c
commit 9c1f5c33a8
15 changed files with 376 additions and 64 deletions

View File

@@ -8,6 +8,7 @@ import (
"testing"
"time"
"github.com/fortytw2/leaktest"
"github.com/google/gopacket/layers"
"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
@@ -18,6 +19,8 @@ import (
)
func TestFunnelIdleTimeout(t *testing.T) {
defer leaktest.Check(t)()
const (
idleTimeout = time.Second
echoID = 42573
@@ -73,13 +76,16 @@ func TestFunnelIdleTimeout(t *testing.T) {
require.NoError(t, proxy.Request(ctx, &pk, &newResponder))
validateEchoFlow(t, <-newMuxer.cfdToEdge, &pk)
time.Sleep(idleTimeout * 2)
cancel()
<-proxyDone
}
func TestReuseFunnel(t *testing.T) {
defer leaktest.Check(t)()
const (
idleTimeout = time.Second
idleTimeout = time.Millisecond * 100
echoID = 42573
startSeq = 8129
)
@@ -135,6 +141,8 @@ func TestReuseFunnel(t *testing.T) {
require.True(t, found)
require.Equal(t, funnel1, funnel2)
time.Sleep(idleTimeout * 2)
cancel()
<-proxyDone
}