Hi Andy,
a global map is the way to go, however writing an reading the map from multiple go routines will fail (in your case different handle calls for connections) because the map data structure is not safe for concurrent use and must be coordinated. the way it is usually solved is by adding another sync.Mutex (mutually exclusive) variable to ensure only one go routine at a has access to the map.
just a heads up, have fun!
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/eff5d382-7bc5-4f2e-9752-a3c850318c0fn%40googlegroups.com.
a global map is the way to go, however writing an reading the map from multiple go routines will fail (in your case different handle calls for connections) because the map data structure is not safe for concurrent use and must be coordinated. the way it is usually solved is by adding another sync.Mutex (mutually exclusive) variable to ensure only one go routine at a has access to the map.
to handle the map not returning a result ( so I don't attempt to
write to a non-existent connection ) I need to know the zero value of
type net.Conn