mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-24 16:40:26 +00:00
be sure to close an SSH connection if all channels are idle
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
1b21c19a78
commit
68a4bbd10c
2 changed files with 5 additions and 3 deletions
|
@ -787,10 +787,12 @@ func (conns *ActiveConnections) checkIdles() {
|
|||
toClose := true
|
||||
for _, conn := range conns.connections {
|
||||
if strings.Contains(conn.GetID(), idToMatch) {
|
||||
if time.Since(conn.GetLastActivity()) <= Config.idleTimeoutAsDuration {
|
||||
toClose = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if toClose {
|
||||
defer func(c *SSHConnection) {
|
||||
err := c.Close()
|
||||
|
|
|
@ -1509,7 +1509,7 @@ func handleWebAddAdminPost(w http.ResponseWriter, r *http.Request) {
|
|||
renderForbiddenPage(w, r, err.Error())
|
||||
return
|
||||
}
|
||||
err = dataprovider.AddAdmin(&admin, claims.Username, util.GetIPFromRemoteAddress(r.Method))
|
||||
err = dataprovider.AddAdmin(&admin, claims.Username, util.GetIPFromRemoteAddress(r.RemoteAddr))
|
||||
if err != nil {
|
||||
renderAddUpdateAdminPage(w, r, &admin, err.Error(), true)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue