• Kirill Smelkov's avatar
    xnet: Provide way to convert xnet.Listener <-> net.Listener · b03d65ff
    Kirill Smelkov authored
    Similarly to what we do in package xio (see 7ad867a3 "xio: Add
    Reader/Writer/... interfaces - io analogs that add support for
    contexts"), add utilities to bind xnet.Listener to context (giving
    net.Listener), and, on the other hand, adapt uncontextified net.Listener
    to xnet.Listener that handles cancellation.
    
    This utilities are needed because a lot of third-party code wants to
    work with net.Listener interface only.
    
    Contrary to xio, we can make it working reliably in both ways (because
    Accept already buffers accepting connections starting at OS level).
    b03d65ff
net.go 7.06 KB