tomaka / rouille

Web framework in Rust
Apache License 2.0
1.12k stars 106 forks source link

How to stop the server? #139

Closed leovailati closed 7 years ago

leovailati commented 7 years ago

Hello,

What is the appropriate way to stop the server?

According to documentation for Server::run():

Runs the server forever, or until the listening socket is somehow force-closed by the operating system.

And start_server never returns (!).

tomaka commented 7 years ago

server.run() is equivalent to loop { server.poll() }, so if you want to stop the server at some point you can just change your code to call server.poll() repeatedly in a loop until some condition becomes true.

leovailati commented 7 years ago

Thank you for your answer. Quick follow-up question: is there a way to exit the handler without responding to a request?

tomaka commented 7 years ago

Unfortunately that's not possible.

leovailati commented 7 years ago

I see, thank you very much!