You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #139 , there's a suggestion to use loop { server.poll() }. However, this is much more CPU-wasteful than calling server.run(), and I think there are several things rouille could do to make this easier.
Server::poll_timeout. The underlying server provides the recv_timeout method, so it would be very easy to add this: using even a small timeout means the CPU usage will be much lower than calling poll in a loop.
Server::handle. This would return a Send + Clone handle which has a method to shutdown the server. This could be implemented by closing the underlying socket, triggering a wake-up, or by setting a flag and then initiating a dummy connection.
The text was updated successfully, but these errors were encountered:
Another approach for this would be to let Server accept an mpsc::Receiver as a shutdown signal, letting the user give the other half of the channel to whatever wants to shut the server down.
This is the approach that Hyper uses, but with a futures::sync::oneshot::channel pair instead of an std::sync::mpsc::channel pair.
In #139 , there's a suggestion to use
loop { server.poll() }
. However, this is much more CPU-wasteful than callingserver.run()
, and I think there are several things rouille could do to make this easier.Server::poll_timeout
. The underlying server provides therecv_timeout
method, so it would be very easy to add this: using even a small timeout means the CPU usage will be much lower than callingpoll
in a loop.Server::handle
. This would return aSend + Clone
handle which has a method to shutdown the server. This could be implemented by closing the underlying socket, triggering a wake-up, or by setting a flag and then initiating a dummy connection.The text was updated successfully, but these errors were encountered: