fix:goroutine leak when open terminal
This commit is contained in:
@@ -71,6 +71,9 @@ type TerminalMessage struct {
|
||||
func (t TerminalSession) Next() *remotecommand.TerminalSize {
|
||||
select {
|
||||
case size := <-t.sizeChan:
|
||||
if size.Height == 0 && size.Width == 0 {
|
||||
return nil
|
||||
}
|
||||
return &size
|
||||
}
|
||||
}
|
||||
@@ -135,6 +138,7 @@ func (t TerminalSession) Toast(p string) error {
|
||||
// For now the status code is unused and reason is shown to the user (unless "")
|
||||
func (t TerminalSession) Close(status uint32, reason string) {
|
||||
klog.Warning(status, reason)
|
||||
close(t.sizeChan)
|
||||
t.conn.Close()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user