Channel release in Go
I have a TCP socket and 2 goroutines that read and write to streams. I am writing a goroutine that reads data from a pipe. If the TCP connection is dropped, then reading from the subroutine will catch an error and stop.
But how can I free the channel that goroutine is written on?
Is there a method, for example chan.release()
, or should I send a special packet that tells the goroutine to end?
+3
source to share