feat: restore patch works fine

This commit is contained in:
fengcaiwen
2023-09-09 12:18:57 +08:00
committed by naison
parent b9798e66f0
commit cacb65efb9
9 changed files with 145 additions and 54 deletions

View File

@@ -69,7 +69,9 @@ func Main(ctx context.Context, remoteEndpoint, localEndpoint *netip.AddrPort, co
if err != nil {
return err
}
done <- struct{}{}
select {
case done <- struct{}{}:
}
// handle incoming connections on reverse forwarded tunnel
for {
select {
@@ -80,10 +82,9 @@ func Main(ctx context.Context, remoteEndpoint, localEndpoint *netip.AddrPort, co
local, err := listen.Accept()
if err != nil {
log.Error(err)
continue
return err
}
go func() {
go func(local net.Conn) {
defer local.Close()
var conn net.Conn
var err error
@@ -99,7 +100,7 @@ func Main(ctx context.Context, remoteEndpoint, localEndpoint *netip.AddrPort, co
}
defer conn.Close()
handleClient(local, conn)
}()
}(local)
}
}