From 60d45f936ee2e864b3c7f5c1fef7b83fab71ecd1 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Mon, 29 Apr 2019 08:06:44 +0200 Subject: [PATCH] REST: trigger start; fix port --- src/rest/gnunet-rest-server.c | 23 ++++++++++++++--------- src/rest/rest.conf | 4 ++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index 3cbb750ba..813525404 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -597,7 +597,7 @@ schedule_httpd () GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, tv, wrs, wws, &do_httpd, NULL); - + } if (NULL != wrs) GNUNET_NETWORK_fdset_destroy (wrs); @@ -822,6 +822,18 @@ run (void *cls, cfg = c; plugin_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); + /* Get port to bind to */ + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "rest", + "PORT", + &port)) + { + //No address specified + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Don't know what port to use...\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } + /* Get address to bind to */ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest", "BIND_TO", @@ -830,7 +842,6 @@ run (void *cls, //No address specified GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Don't know what to bind to...\n"); - GNUNET_free (addr_str); GNUNET_SCHEDULER_shutdown (); return; } @@ -852,7 +863,6 @@ run (void *cls, //No address specified GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Don't know what to bind6 to...\n"); - GNUNET_free (addr_str); GNUNET_SCHEDULER_shutdown (); return; } @@ -980,11 +990,6 @@ int main (int argc, char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_ulong ('p', - "port", - "PORT", - gettext_noop ("listen on specified port (default: 7776)"), - &port), GNUNET_GETOPT_OPTION_END }; static const char* err_page = diff --git a/src/rest/rest.conf b/src/rest/rest.conf index 3674c3850..400db19a6 100644 --- a/src/rest/rest.conf +++ b/src/rest/rest.conf @@ -1,10 +1,10 @@ [rest] UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock BINARY=gnunet-rest-server -IMMEDIATE_START=YES +START_ON_DEMAND=YES BIND_TO=127.0.0.1 BIND_TO6=::1 -REST_PORT=7776 +PORT=7776 REST_ALLOW_HEADERS=Authorization,Accept,Content-Type REST_ALLOW_ORIGIN=* REST_ALLOW_CREDENTIALS=true -- 2.25.1