From: Schanzenbach, Martin Date: Mon, 29 Apr 2019 06:06:44 +0000 (+0200) Subject: REST: trigger start; fix port X-Git-Tag: v0.11.4~59^2~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=60d45f936ee2e864b3c7f5c1fef7b83fab71ecd1;p=oweals%2Fgnunet.git REST: trigger start; fix port --- 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