You have to be careful with this approach and high volume (longer latency) tcp. Often there can be TCP "stalls" and if you have a messaging type protocol, you need to make sure you can handle partial reads and re-combine, because the deadline may fire during the read (typically a problem with text based line protocols).
-----Original Message-----
From: "Jason E. Aten"
Sent: Aug 26, 2019 6:58 AM
To: golang-nuts
Subject: [go-nuts] Re: I know you cannot kill a goroutine, but ...--I could not get a goroutine to shut down if it is waiting on user input from a socket, or a dropped connection, although that begs the question of how to get the socket-reading goroutine to now shut down.My usual approach is to set 100ms read deadlines and then check for the shutdown request inside the read loop.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/ab103eb3-a3d4-40c6-90f6-75dba0fd904a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1131268654.2072.1566828899095%40wamui-albus.atl.sa.earthlink.net.