Closed chorfa007 closed 1 year ago
Please edit the above comment to fix the line-wrap on the stack trace.
I agree that being able to edit the routes live would be a really nice feature. If the API is there, then it should work.
The most useful thing to do would be to create a PR (pull request) that adds a (currently crashing) unit test that replicates the above. Someone else can then get your PR onto their development box and dig into the problem.
All, I went deeper into my example and was able to resolve the exception, the root cause was that I deleted a route that does not exist:( I added extra checks and i have seen that if i start the server with :
Here i'm excepted that both URL 1 and 2 mode 2 should be reachable which is not the case, so i believe that the issue is here. The API cannot rebuild the data structure of routes correctly after a dynamisc changes . [It is not taking into account the new route, it is look like the data structure holding routes in the library is cleared and never updataed after calling route::remove) You can replicate the same with my pull request https://github.com/pistacheio/pistache/pull/1105/commits/aae7a4a1b55ee54d93eef167a3f321455af8a4da
Please note that the Router::remove API is not tested as a unit, which may explain why this issue was not detected previously.
All thanks you in advance for your assistance.
To make the route mutable please use ` /**
iso
std::shared_ptr<Private::RouterHandler> handler() const;
Please note that the API is not thread safe, you can refer the example of arghness if need a thread safe API https://github.com/pistacheio/pistache/pull/1105
Dear All,
I would like to implement a server where i add and remove routes dynamically without rebooting server. Below the example
Each time i call the function Routes::Remove via Server::SwitchMode(), i end with exception : terminate called after throwing an instance of 'std::runtime_error' what(): Requested does not exist. Aborted (core dumped) Below the back trace :+1: `(gdb) bt
The problem is in line 233 file src/server/router.cc. I would like to know if i' m using the correct syntax Routes::remove ? If no then i guess this can be a possible issue in the pistache server and need to be fixed.
Thanks.