Few fixes after rebase

This commit is contained in:
Gioacchino Mazzurco 2020-01-06 14:46:36 +01:00
parent df87fe53b1
commit f4f7b8a1ea
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
4 changed files with 46 additions and 33 deletions

View file

@ -1,7 +1,8 @@
/*
* RetroShare JSON API
*
* Copyright (C) 2018-2019 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2018-2020 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2019-2020 Asociación Civil Altermundi <info@altermundi.net>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the
@ -588,19 +589,12 @@ bool JsonApiServer::restart()
return true;
}
void JsonApiServer::onStopRequested()
{ if(mService->is_up()) mService->stop(); }
bool JsonApiServer::fullstop()
{
if(!mService->is_up()) return true;
mService->stop();
RsThread::ask_for_stop();
while(isRunning())
{
RsDbg() << __PRETTY_FUNCTION__ << " shutting down JSON API service."
<< std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
RsThread::fullstop();
return true;
}
@ -610,7 +604,7 @@ void JsonApiServer::setBindingAddress(const std::string& bindAddress)
{ mBindingAddress = bindAddress; }
std::string JsonApiServer::getBindingAddress() const { return mBindingAddress; }
void JsonApiServer::runloop()
void JsonApiServer::run()
{
auto settings = std::make_shared<restbed::Settings>();
settings->set_port(mListeningPort);

View file

@ -1,7 +1,8 @@
/*
* RetroShare JSON API
*
* Copyright (C) 2018-2019 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2018-2020 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2019-2020 Asociación Civil Altermundi <info@altermundi.net>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the
@ -139,6 +140,10 @@ public:
const std::function<bool(const std::string&, const std::string&)>&
callback );
protected:
/// @see RsThread
void onStopRequested() override;
private:
/// @see RsThread
void run() override;
@ -187,9 +192,6 @@ private:
std::reference_wrapper<const JsonApiResourceProvider>,
std::less<const JsonApiResourceProvider> > mResourceProviders;
/// @see RsThread
void runloop() override;
std::shared_ptr<restbed::Service> mService;
uint16_t mListeningPort;