diff options
| author | Shulhan <ms@kilabit.info> | 2023-12-14 19:21:12 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-12-14 20:23:47 +0700 |
| commit | d281c094b88ab6bb2d6ccd0eb572d4275a9ab371 (patch) | |
| tree | 25efe987274b1135157e8d235abc3d5de219e079 /session.go | |
| parent | 1b1f3962ff42ee12ae6c573909629b61411cbddf (diff) | |
| download | awwan-d281c094b88ab6bb2d6ccd0eb572d4275a9ab371.tar.xz | |
all: close the SSH connection once Play finished
Previously, we used to run awwan as CLI so each connection is open and
closed (forcefully).
Since we now use awwan WUI frequently, any command that execute Play
does not close the session immediately once finished.
This cause many connections open in remote server.
This changes close the SSH connections immediately once the Play command
finished.
Diffstat (limited to 'session.go')
| -rw-r--r-- | session.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -410,6 +410,16 @@ func ExecLocal(req *ExecRequest, stmt *Statement) (err error) { return nil } +// close the session and release all resources. +func (ses *Session) close() (err error) { + ses.cryptoc = nil + if ses.sshc != nil { + err = ses.sshc.close() + ses.sshc = nil + } + return err +} + // executeRequires run the "#require:" statements from line 0 until // the start argument in the local system. func (ses *Session) executeRequires(req *ExecRequest, pos linePosition) (err error) { |
