mirror of
https://github.com/apple/swift-nio
synced 2026-11-29 05:24:21 +00:00
Motivation: Previously we would eagerly register any fd with the selector (epoll/kqueue) which works well with kqueue. With epoll however, you'll get `EPOLLHUP` immediately if you supplied a socket that hasn't had connect/bind called on it. We got away with this because we took quite a bit of care to always make sure we call connect/bind pretty much immediately after we registered it. And crucially before we ever asked the selector to tell us about new events. Modifications: made selector registration lazy (when we try activating the channel by calling connect/bind) Result: the user can now register and connect whenever they feel like it.