From 1b3709657f6a0060c19474d81ba4aa51150e3905 Mon Sep 17 00:00:00 2001 From: "jevin.shi" Date: Thu, 15 Jun 2023 22:33:46 +0800 Subject: [PATCH 1/2] Fix isConnect logic mistake --- common/uot/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/uot/server.go b/common/uot/server.go index 6457878e..b620ccee 100644 --- a/common/uot/server.go +++ b/common/uot/server.go @@ -60,7 +60,7 @@ func (c *ServerConn) loopInput() { for { var destination M.Socksaddr var err error - if !c.isConnect { + if c.isConnect { destination = c.destination } else { destination, err = AddrParser.ReadAddrPort(c.inputReader) From 6fe2b45e99d1b5ab7e4d86dcf50fa04b2c3a0746 Mon Sep 17 00:00:00 2001 From: "jevin.shi" Date: Wed, 28 Jun 2023 09:50:41 +0800 Subject: [PATCH 2/2] Fix the problem of OMM Killer triggered by too many UDP connections --- common/uot/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/uot/server.go b/common/uot/server.go index b620ccee..a6e42239 100644 --- a/common/uot/server.go +++ b/common/uot/server.go @@ -4,6 +4,7 @@ import ( "encoding/binary" "io" "net" + "time" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" @@ -89,6 +90,7 @@ func (c *ServerConn) loopInput() { if err != nil { break } + c.SetDeadline(time.Now().Add(2 * time.Minute)) } c.Close() } @@ -105,6 +107,7 @@ func (c *ServerConn) loopOutput() { if err != nil { break } + c.SetDeadline(time.Now().Add(2 * time.Minute)) if !c.isConnect { err = AddrParser.WriteAddrPort(c.outputWriter, M.SocksaddrFromNet(addr)) if err != nil {