Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing server settings #103

Open
Lord-Kamina opened this issue Jun 6, 2020 · 1 comment
Open

Changing server settings #103

Lord-Kamina opened this issue Jun 6, 2020 · 1 comment

Comments

@Lord-Kamina
Copy link

Lord-Kamina commented Jun 6, 2020

Say I have an instance of http_server_t, and most of the server settings are end-user configurable. Is it possible to change said server's settings (Of course I assume I'd need to close the server and open it again), or is it better to just make a new instance with the new settings to replace the old one?

Additionally, in a situation such as described above... what should I do with the io_context? I'm currently using restinio::own_io_context(), do I also need to stop and restart the io_context (I'm thinking yes), would you recommend I keep using restinio::own_io_context() or should I switch to an external io_context?

@eao197
Copy link
Member

eao197 commented Jun 7, 2020

Is it possible to change said server's settings (Of course I assume I'd need to close the server and open it again), or is it better to just make a new instance with the new settings to replace the old one?

In the current design, the settings are split to several parts and those parts are stored in different objects behind http_server_t instance. And this is performed only at the initialization time (in the constructors of http_server_t and related objects). So you can't change server settings after the creation of http_server_t instance in RESTinio 0.6. You have to recreate the server to apply new settings.

I'm currently using restinio::own_io_context(), do I also need to stop and restart the io_context (I'm thinking yes),

If you recreate http_server_t instance with own_io_contect then io_context will be recreated automatically too. If it is an issue for your usecase (for example, you attach some of your objects to RESTinio's io_context and don't want to lost them) then you have to use external io_context to keep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants