Skip to content

Commit

Permalink
fix(server): Allow timer to be garbage collected more quickly
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Sep 5, 2023
1 parent 5f81050 commit 4b3ee31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/server/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (s *SSHServer) Handler(m *movie.Movie) bubbletea.ProgramHandler {
go func() {
if timeout != 0 {
timer := time.NewTimer(timeout)
defer timer.Stop()
select {
case <-timer.C:
program.Send(movie.Quit())
Expand Down
1 change: 1 addition & 0 deletions internal/server/telnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func (s *TelnetServer) Handler(ctx context.Context, conn net.Conn, m *movie.Movi
go func() {
if timeout != 0 {
timer := time.NewTimer(timeout)
defer timer.Stop()
select {
case <-timer.C:
program.Send(movie.Quit())
Expand Down

0 comments on commit 4b3ee31

Please sign in to comment.