fix max connections check

Also make sure to close the ssh client connection in test cases
This commit is contained in:
Nicola Murino
2021-04-20 18:12:16 +02:00
parent 92638ce93d
commit f4369cdbef
8 changed files with 503 additions and 240 deletions

View File

@@ -147,6 +147,9 @@ func (s *webDavServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Error(w, common.ErrGenericFailure.Error(), http.StatusInternalServerError)
}
}()
common.Connections.AddNetworkConnection()
defer common.Connections.RemoveNetworkConnection()
if !common.Connections.IsNewConnectionAllowed() {
logger.Log(logger.LevelDebug, common.ProtocolFTP, "", "connection refused, configured limit reached")
http.Error(w, common.ErrConnectionDenied.Error(), http.StatusServiceUnavailable)