From 6f0666fc6d49030c0bf282a9dc493ce5d941c3cd Mon Sep 17 00:00:00 2001 From: swordlet Date: Sat, 12 Aug 2023 20:15:16 +0800 Subject: [PATCH 1/2] fixed bug --- server/proxy/proxy.go | 8 ++++++-- server/tcp/server.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/proxy/proxy.go b/server/proxy/proxy.go index 1001f4a..394b43b 100644 --- a/server/proxy/proxy.go +++ b/server/proxy/proxy.go @@ -283,8 +283,12 @@ func (p *Proxy) handleNotification(notif []byte) { } func (p *Proxy) connect(minerName string) error { - // p.connMu.Lock() - // defer p.connMu.Unlock() + p.connMu.Lock() + defer p.connMu.Unlock() + + if p.isClosed { + return errors.New("using closed proxy error") + } var conn net.Conn var socks5Dialer proxy.Dialer diff --git a/server/tcp/server.go b/server/tcp/server.go index 4a12555..9f9211e 100644 --- a/server/tcp/server.go +++ b/server/tcp/server.go @@ -47,7 +47,7 @@ func StartServer() { if err != nil { logger.Get().Println("Unable to accept connection: ", err) } - conn.SetReadDeadline(time.Now().Add(45 * time.Second)) + conn.SetReadDeadline(time.Now().Add(90 * time.Second)) // if !limit.Allow() { // logger.Get().Println("Out of rate limit:", rl, "per 25 ms.") From dde560552e2dccd1d4e0b43d897e6a253ac10e4c Mon Sep 17 00:00:00 2001 From: swordlet Date: Sat, 12 Aug 2023 20:15:45 +0800 Subject: [PATCH 2/2] update version --- server/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/main.go b/server/main.go index 2be21c0..fda01c8 100644 --- a/server/main.go +++ b/server/main.go @@ -14,7 +14,7 @@ import ( ) var ( - version = "2.0.3" + version = "2.0.4" // cmd line options configFile *string