mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
refactoring of user session counters
Fixes #792 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -43,7 +43,6 @@ func ServeSubSystemConnection(user *dataprovider.User, connectionID string, read
|
||||
logger.Warn(logSender, connectionID, "unable to check fs root: %v close fs error: %v", err, errClose)
|
||||
return err
|
||||
}
|
||||
dataprovider.UpdateLastLogin(user)
|
||||
|
||||
connection := &Connection{
|
||||
BaseConnection: common.NewBaseConnection(connectionID, common.ProtocolSFTP, "", "", *user),
|
||||
@@ -52,9 +51,15 @@ func ServeSubSystemConnection(user *dataprovider.User, connectionID string, read
|
||||
LocalAddr: &net.IPAddr{},
|
||||
channel: newSubsystemChannel(reader, writer),
|
||||
}
|
||||
common.Connections.Add(connection)
|
||||
err = common.Connections.Add(connection)
|
||||
if err != nil {
|
||||
errClose := user.CloseFs()
|
||||
logger.Warn(logSender, connectionID, "unable to add connection: %v close fs error: %v", err, errClose)
|
||||
return err
|
||||
}
|
||||
defer common.Connections.Remove(connection.GetID())
|
||||
|
||||
dataprovider.UpdateLastLogin(user)
|
||||
server := sftp.NewRequestServer(connection.channel, sftp.Handlers{
|
||||
FileGet: connection,
|
||||
FilePut: connection,
|
||||
|
||||
Reference in New Issue
Block a user