On Thu, Dec 21, 2023 at 1:11 AM Michał Matczuk <
mmat...@gmail.com> wrote:
>
> net.ListenConfig does not document the context usage. The docs just point to Listen. I'd expect that cancelling the context would stop the listener but it's not the case.
>
> The questions are:
>
> * Should Listener created with net.ListenConfig.Listen be closed - is that a bug, if not why?
This is not a bug. While there are exceptions in special cases, in
general a Context is specific to a particular operation, in this case
opening the listening socket. It's not in general applicable to all
listening on a socket. (It's perhaps worth noting that if
ListenConfig had ControlContext as Dialer does, then the Context would
be passed to ListenerConfig.ControlContext.)
> * Is the above document anywhere?
I sent
https://go.dev/cl/620777 to document it. Thanks for bringing
it up. Sorry for the very slow response.
Ian
> To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/48237db5-fe65-4dad-8035-b8c32643219an%40googlegroups.com.