mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
fixed changing ports and restarting
This commit is contained in:
parent
3446f0b677
commit
9dc78d66c1
3 changed files with 23 additions and 9 deletions
|
@ -130,11 +130,21 @@ public:
|
|||
settings->set_port( _listening_port );
|
||||
settings->set_default_header( "Connection", "close" );
|
||||
|
||||
if(_service->is_up())
|
||||
{
|
||||
std::cerr << "WebUI is already running. Killing it." << std::endl;
|
||||
_service->stop();
|
||||
}
|
||||
|
||||
_service = std::make_shared<restbed::Service>();
|
||||
|
||||
_service->publish( resource1 );
|
||||
_service->publish( resource2 );
|
||||
_service->publish( resource3 );
|
||||
|
||||
_service->set_ready_handler( service_ready_handler );
|
||||
std::cerr << "Starting web service on port " << std::dec << _listening_port << std::endl;
|
||||
//_service->set_ready_handler( service_ready_handler );
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -145,6 +155,8 @@ public:
|
|||
RsErr() << "Could not start web interface: " << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "(II) Shutting down webui service." << std::endl;
|
||||
}
|
||||
void stop()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue