Skip to content

Commit 4b6c61b

Browse files
committed
Fix HTTP shutdown cleaning up shell servers with active sessions.
1 parent 0701aba commit 4b6c61b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

c2/httpserveshell/httpserveshell.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ func (serveShell *Server) Shutdown() bool {
112112
// Each of the shell sessions and httpservefile sessions should be handled by the channel Shutdown
113113
// atomic.
114114
if serveShell.SSLShell {
115-
sslshell.GetInstance().Channel().Shutdown.Store(true)
115+
if !sslshell.GetInstance().Channel().HasSessions() {
116+
sslshell.GetInstance().Channel().Shutdown.Store(true)
117+
}
116118
} else {
117-
simpleshell.GetServerInstance().Channel().Shutdown.Store(true)
119+
if !simpleshell.GetServerInstance().Channel().HasSessions() {
120+
simpleshell.GetServerInstance().Channel().Shutdown.Store(true)
121+
}
118122
}
119123
httpservefile.GetInstance().Channel().Shutdown.Store(true)
120124

0 commit comments

Comments
 (0)