retroshare-nogui print message if JSON API is active

This commit is contained in:
Gioacchino Mazzurco 2018-09-13 01:46:55 +02:00
parent 148e46346d
commit d676ba3937
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -51,6 +51,8 @@
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
# include <csignal> # include <csignal>
# include "jsonapi/jsonapi.h" # include "jsonapi/jsonapi.h"
# include "util/rsnet.h"
# include "util/rsurl.h"
#endif // RS_JSONAPI #endif // RS_JSONAPI
/* Basic instructions for running libretroshare as background thread. /* Basic instructions for running libretroshare as background thread.
@ -91,6 +93,16 @@ int main(int argc, char **argv)
[](int /*ec*/) { std::raise(SIGTERM); } ); [](int /*ec*/) { std::raise(SIGTERM); } );
jsonApiServer->start("JSON API Server"); jsonApiServer->start("JSON API Server");
sockaddr_storage tmp;
sockaddr_storage_inet_pton(tmp, jsonApiBindAddress);
sockaddr_storage_setport(tmp, jsonApiPort);
sockaddr_storage_ipv6_to_ipv4(tmp);
RsUrl tmpUrl(sockaddr_storage_tostring(tmp));
tmpUrl.setScheme("http");
std::cerr << "JSON API listening on " << tmpUrl.toString()
<< std::endl;
} }
#endif // RS_JSONAPI #endif // RS_JSONAPI