Make JSON API server bind address configurable

Enforce it being 127.0.0.1 by default, I assumed 127.0.0.1 was restbed
default, but as reported by sehraf is not alwayd the case

JSON API bind address now is also configurable via commandline on
retroshare-android-service and retroshare-nogui, while it obey the
configuration of webui (execept for that port is incremented by 2)
in retroshare-gui
This commit is contained in:
Gioacchino Mazzurco 2018-09-05 00:08:56 +02:00
parent 4acbf775a5
commit a194e4cf56
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
5 changed files with 76 additions and 24 deletions

View file

@ -35,7 +35,8 @@ namespace rb = restbed;
struct JsonApiServer : RsSingleJobThread
{
JsonApiServer(
uint16_t port,
uint16_t port = 9092,
const std::string& bindAddress = "127.0.0.1",
const std::function<void(int)> shutdownCallback = [](int){} );
/// @see RsSingleJobThread
@ -66,7 +67,8 @@ struct JsonApiServer : RsSingleJobThread
void shutdown(int exitCode = 0);
private:
uint16_t mPort;
const uint16_t mPort;
const std::string mBindAddress;
rb::Service mService;
const std::function<void(int)> mShutdownCallback;
};