mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 15:10:23 +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,8 +787,10 @@ func (conns *ActiveConnections) checkIdles() {
|
|||
toClose := true
|
||||
for _, conn := range conns.connections {
|
||||
if strings.Contains(conn.GetID(), idToMatch) {
|
||||
toClose = false
|
||||
break
|
||||
if time.Since(conn.GetLastActivity()) <= Config.idleTimeoutAsDuration {
|
||||
toClose = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if toClose {
|
||||
|
|
|
@ -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