go-chromecast is an amazing tool. I am writing a Go implementation of sponsorblockcast called CastSponsorSkip and have noticed if a device disconnects and I call Application.Close(), some Goroutines never exit resulting in a slight memory leak.
This PR closes those channels when Application.Close() and Connection.Close() are called. I opted to close the channels in a defer so that they stay open while the underlying connection is closed. Let me know if you have any feedback!
Hello!
go-chromecast is an amazing tool. I am writing a Go implementation of sponsorblockcast called CastSponsorSkip and have noticed if a device disconnects and I call
Application.Close()
, some Goroutines never exit resulting in a slight memory leak.The problematic functions are:
Application.messageChanHandler()
due toApplication.messageChan
not being closed.Application.recvMessages()
due toConnection.recvMsgChan
not being closed.This PR closes those channels when
Application.Close()
andConnection.Close()
are called. I opted to close the channels in adefer
so that they stay open while the underlying connection is closed. Let me know if you have any feedback!