Closed heifner closed 1 month ago
create_listener
shouldn't blanket do this because some users of it (http) don't actually need the per connection strand. It should be driven by a parameter or different function name
Actually, because of https://github.com/AntelopeIO/spring/pull/816#discussion_r1774606535 I'm not sure create_listener
should simply make the strand on the same executor it's using for listening. For this particular case it really seems best for the listener to remain on the main thread and have the socket with a strand in ship's thread. So maybe create_listener
needs to take a functor that is called on each async_accept()
that returns the executor for that call. To provide the most flexibility.
Currently
fc::create_listener
creates sockets with the provided executor. For our use cases, it would be nice iffc::create_listener
would create a strand for each socket. The users offc::create_listener
could then retrieve the strand from thesocket.get_executor()
for use.Something like: https://github.com/AntelopeIO/spring/commit/438ae6223d7012f75f41b8332a0becda79ef723d
Then:
socket.get_executor()
instead of making a new strand.net_plugin
to use the socket strand instead of creating a different one.