From 6f0666fc6d49030c0bf282a9dc493ce5d941c3cd Mon Sep 17 00:00:00 2001 From: swordlet Date: Sat, 12 Aug 2023 20:15:16 +0800 Subject: [PATCH] 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.")