This commit is contained in:
esrrhs 2019-10-31 21:18:42 +08:00
parent 64f8ec24e6
commit 2a75a80a0e
2 changed files with 3 additions and 3 deletions

View File

@ -276,7 +276,7 @@ func (p *Client) AcceptTcpConn(conn *net.TCPConn, targetAddr string) {
tcpsrcaddr := conn.RemoteAddr().(*net.TCPAddr) tcpsrcaddr := conn.RemoteAddr().(*net.TCPAddr)
if p.localIdToConnMapSize >= p.maxconn { if p.maxconn > 0 && p.localIdToConnMapSize >= p.maxconn {
loggo.Info("too many connections %d, client accept new local tcp fail %s", p.localIdToConnMapSize, tcpsrcaddr.String()) loggo.Info("too many connections %d, client accept new local tcp fail %s", p.localIdToConnMapSize, tcpsrcaddr.String())
return return
} }
@ -492,7 +492,7 @@ func (p *Client) Accept() error {
now := time.Now() now := time.Now()
clientConn := p.getClientConnByAddr(srcaddr.String()) clientConn := p.getClientConnByAddr(srcaddr.String())
if clientConn == nil { if clientConn == nil {
if p.localIdToConnMapSize >= p.maxconn { if p.maxconn > 0 && p.localIdToConnMapSize >= p.maxconn {
loggo.Info("too many connections %d, client accept new local udp fail %s", p.localIdToConnMapSize, srcaddr.String()) loggo.Info("too many connections %d, client accept new local udp fail %s", p.localIdToConnMapSize, srcaddr.String())
continue continue
} }

View File

@ -121,7 +121,7 @@ func (p *Server) processPacket(packet *Packet) {
localConn := p.getServerConnById(id) localConn := p.getServerConnById(id)
if localConn == nil { if localConn == nil {
if p.localConnMapSize >= p.maxconn { if p.maxconn > 0 && p.localConnMapSize >= p.maxconn {
loggo.Info("too many connections %d, server connected target fail %s", p.localConnMapSize, packet.my.Target) loggo.Info("too many connections %d, server connected target fail %s", p.localConnMapSize, packet.my.Target)
return return
} }