mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
sftpd: refactor connection closing
we have not known bugs with the previous implementation anyway this one is cleaner: the underlying network connection is directly related with SFTP/SCP connections. This should better protect us against buggy clients and edge cases
This commit is contained in:
@@ -299,7 +299,8 @@ func (c Configuration) AcceptInboundConnection(conn net.Conn, config *ssh.Server
|
||||
}
|
||||
|
||||
func (c Configuration) handleSftpConnection(channel ssh.Channel, connection Connection) {
|
||||
addConnection(connection.ID, connection)
|
||||
addConnection(connection)
|
||||
defer removeConnection(connection)
|
||||
// Create a new handler for the currently logged in user's server.
|
||||
handler := c.createHandler(connection)
|
||||
|
||||
@@ -312,8 +313,6 @@ func (c Configuration) handleSftpConnection(channel ssh.Channel, connection Conn
|
||||
} else if err != nil {
|
||||
connection.Log(logger.LevelWarn, logSender, "connection closed with error: %v", err)
|
||||
}
|
||||
|
||||
removeConnection(connection.ID)
|
||||
}
|
||||
|
||||
func (c Configuration) createHandler(connection Connection) sftp.Handlers {
|
||||
|
||||
Reference in New Issue
Block a user