refactor: remove slug channel from session struct

This commit is contained in:
2025-07-21 11:37:57 +07:00
parent 82c112984e
commit 32f9765374

View File

@ -48,7 +48,6 @@ type Session struct {
ForwardedPort uint16
Status SessionStatus
Slug string
SlugChannel chan bool
Done chan bool
}
@ -554,7 +553,7 @@ func (s *Session) HandleForwardedConnection(conn UserConnection, sshConn *ssh.Se
}
defer channel.Close()
go handleChannelRequests(reqs, conn, channel, s.SlugChannel)
go handleChannelRequests(reqs, conn, channel)
if conn.Reader == nil {
conn.Reader = bufio.NewReader(conn.Writer)
@ -577,7 +576,7 @@ func (s *Session) HandleForwardedConnection(conn UserConnection, sshConn *ssh.Se
io.Copy(conn.Writer, reader)
}
func handleChannelRequests(reqs <-chan *ssh.Request, conn UserConnection, channel ssh.Channel, slugChannel <-chan bool) {
func handleChannelRequests(reqs <-chan *ssh.Request, conn UserConnection, channel ssh.Channel) {
select {
case <-reqs:
for req := range reqs {
@ -588,11 +587,6 @@ func handleChannelRequests(reqs <-chan *ssh.Request, conn UserConnection, channe
channel.Close()
log.Println("Connection closed by timeout")
return
case <-slugChannel:
conn.Writer.Close()
channel.Close()
log.Println("Connection closed by slug change")
return
}
}