File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ type localDoHHandler struct {
1818
1919func (handler localDoHHandler ) ServeHTTP (writer http.ResponseWriter , request * http.Request ) {
2020 proxy := handler .proxy
21+ if ! proxy .clientsCountInc () {
22+ dlog .Warnf ("Too many incoming connections (max=%d)" , proxy .maxClients )
23+ return
24+ }
25+ defer proxy .clientsCountDec ()
2126 dataType := "application/dns-message"
2227 writer .Header ().Set ("Server" , "dnscrypt-proxy" )
2328 if request .URL .Path != proxy .localDoHPath {
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ func (proxy *Proxy) udpListener(clientPc *net.UDPConn) {
264264 go func () {
265265 start := time .Now ()
266266 if ! proxy .clientsCountInc () {
267- dlog .Warnf ("Too many connections (max=%d)" , proxy .maxClients )
267+ dlog .Warnf ("Too many incoming connections (max=%d)" , proxy .maxClients )
268268 return
269269 }
270270 defer proxy .clientsCountDec ()
@@ -294,7 +294,7 @@ func (proxy *Proxy) tcpListener(acceptPc *net.TCPListener) {
294294 start := time .Now ()
295295 defer clientPc .Close ()
296296 if ! proxy .clientsCountInc () {
297- dlog .Warnf ("Too many connections (max=%d)" , proxy .maxClients )
297+ dlog .Warnf ("Too many incoming connections (max=%d)" , proxy .maxClients )
298298 return
299299 }
300300 defer proxy .clientsCountDec ()
You can’t perform that action at this time.
0 commit comments