Accept any EventLoops in `.delegate(on:)`, not just ones from AHC's own ELG
weissi opened this issue · 0 comments
weissi commented
The badly named but highly useful .delegate(on:)
specifies two things:
- Which
EventLoop
the returned futures are bound to - Which
EventLoop
the delegate callouts happen on.
Crucially it does not specify on what EventLoop
the underlying Channel
s are running on. Yes, as an optimisation if possible & sensible (i.e. the connection pool doesn't already have a valid connection) we try to create new Channel
s on the same EventLoop
but that's neither guaranteed nor required.
Expected behaviour
If I pass a random EventLoop
to AHC's eventLoop: .delegate(on: myRandomEL)
then I would expect this to work, even if AHC itself is using an EventLoopGroup
that doesn't contain my EventLoop
for its Channel
s.
Actual behaviour
AHC crashes and tells me that I can only use EventLoop
s from AHC's EventLoopGroup
at runtime. That's bad an unnecessary.