My TLS proxy used to create two goroutines of `io.Copy` to copy between the incoming and outgoing connection.
As soon as `io.Copy` returned, with or without an error, I closed both connections. This had the effect that on the other goroutine, the Read/Write returned with errors about the "use of a closed network connection". In order to prevent the errors, I used context.Context like this: https://github.com/nhooyr/tlswrapd/blob/master/proxy.go#L88-L143 Several things I am unsure about now. First, I feel like I am misusing context.Context. Second, should I even bother synchronizing everything myself? As in, should I just have a channel with a single buffer where the first error is sent and then only print that and assume the other error is a result from closing the connections? -- 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. For more options, visit https://groups.google.com/d/optout.