Feature #5604

Document undocumented WServer member functions

Added by Kayra Akman over 5 years ago. Updated over 5 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


While looking for a way to programmatically stop WServer, I have noticed that these functions are not documented and not available in Doxygen documentation:

  • WServer::expireSessions()
  • WServer::configuration()
  • WServer::controller()
  • WServer::scheduleStop()

These are the ones I notices. There is at least one function(e.g. WServer::terminate()) whose existence is platform-dependent.

WServer::scheduleStop() is very interesting: Calling WServer::stop() doesn't cause WServer::run() to return because, AFAIK, WServer::waitForShutdown() remains blocked. WServer::scheduleStop() seems to be the correct way to properly stop the server programmatically and return from main(). In fact it seems that calling WServer::stop() while WServer::waitForShutdown() is blocked renders the server unusable because calling WServer::resume() doesn't work as expected or shoulkdn't be called in this scenario. Server starts to accept connections, but instead of the applicaton an empty page is served. Readding the application with WServer::addEntryPoint() before calling WServer::resume() also doesn't change the outcome. WServert::start() instead of WServer::resume() is also not a solution. Consider the following log messages:

[2017-Mar-16 14:46:41.382526] 5852 - [info] "WServer/wthttp: Shutdown: stopping web server."
[2017-Mar-16 14:46:51.372525] 5852 - [error] "WServer/wthttp: start(): server already started!"

It would be useful for users if a discussion of programmatic shutdown of WServer was added to WServer documentation and/or Library overview. IMHO, better documentation for WServer::stop() and WServer::resume() is also needed.


server_test.cpp (1.09 KB) server_test.cpp Kayra Akman, 03/16/2017 01:11 PM

Also available in: Atom PDF