Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 51F7E200BBB for ; Wed, 26 Oct 2016 14:15:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 50AC8160B08; Wed, 26 Oct 2016 12:15:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9FA23160AFD for ; Wed, 26 Oct 2016 14:15:27 +0200 (CEST) Received: (qmail 33213 invoked by uid 500); 26 Oct 2016 12:15:26 -0000 Mailing-List: contact commits-help@celix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@celix.apache.org Delivered-To: mailing list commits@celix.apache.org Received: (qmail 32515 invoked by uid 99); 26 Oct 2016 12:15:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Oct 2016 12:15:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DF336E69A3; Wed, 26 Oct 2016 12:15:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pnoltes@apache.org To: commits@celix.apache.org Date: Wed, 26 Oct 2016 12:15:27 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [04/50] [abbrv] celix git commit: CELIX-373: made endpoint_server number configurable. Default value raised to 15 archived-at: Wed, 26 Oct 2016 12:15:28 -0000 CELIX-373: made endpoint_server number configurable. Default value raised to 15 Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/2bc39ca9 Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/2bc39ca9 Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/2bc39ca9 Branch: refs/heads/master Commit: 2bc39ca9246abb8139b400715704723e9e9f4391 Parents: 216032c Author: gricciardi Authored: Fri Aug 26 17:44:07 2016 +0200 Committer: gricciardi Committed: Fri Aug 26 17:44:07 2016 +0200 ---------------------------------------------------------------------- .../discovery/private/include/discovery.h | 1 + .../private/src/endpoint_discovery_server.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/2bc39ca9/remote_services/discovery/private/include/discovery.h ---------------------------------------------------------------------- diff --git a/remote_services/discovery/private/include/discovery.h b/remote_services/discovery/private/include/discovery.h index 9695a3c..ee79caf 100644 --- a/remote_services/discovery/private/include/discovery.h +++ b/remote_services/discovery/private/include/discovery.h @@ -38,6 +38,7 @@ #define DISCOVERY_SERVER_PORT "DISCOVERY_CFG_SERVER_PORT" #define DISCOVERY_SERVER_PATH "DISCOVERY_CFG_SERVER_PATH" #define DISCOVERY_POLL_ENDPOINTS "DISCOVERY_CFG_POLL_ENDPOINTS" +#define DISCOVERY_SERVER_MAX_EP "DISCOVERY_CFG_SERVER_MAX_EP" typedef struct discovery *discovery_pt; http://git-wip-us.apache.org/repos/asf/celix/blob/2bc39ca9/remote_services/discovery/private/src/endpoint_discovery_server.c ---------------------------------------------------------------------- diff --git a/remote_services/discovery/private/src/endpoint_discovery_server.c b/remote_services/discovery/private/src/endpoint_discovery_server.c index 6273e6f..f5f82af 100644 --- a/remote_services/discovery/private/src/endpoint_discovery_server.c +++ b/remote_services/discovery/private/src/endpoint_discovery_server.c @@ -40,7 +40,7 @@ #include "endpoint_descriptor_writer.h" // defines how often the webserver is restarted (with an increased port number) -#define MAX_NUMBER_OF_RESTARTS 5 +#define MAX_NUMBER_OF_RESTARTS 15 #define DEFAULT_SERVER_THREADS "1" #define CIVETWEB_REQUEST_NOT_HANDLED 0 @@ -79,6 +79,9 @@ celix_status_t endpointDiscoveryServer_create(discovery_pt discovery, bundle_con const char *ip = NULL; char *detectedIp = NULL; const char *path = NULL; + const char *retries = NULL; + + int max_ep_num = MAX_NUMBER_OF_RESTARTS; *server = malloc(sizeof(struct endpoint_discovery_server)); if (!*server) { @@ -137,6 +140,15 @@ celix_status_t endpointDiscoveryServer_create(discovery_pt discovery, bundle_con path = DEFAULT_SERVER_PATH; } + bundleContext_getProperty(context, DISCOVERY_SERVER_MAX_EP, &retries); + if (retries != NULL) { + errno=0; + max_ep_num = strtol(retries,NULL,10); + if(errno!=0 || max_ep_num<=0){ + max_ep_num=MAX_NUMBER_OF_RESTARTS; + } + } + (*server)->path = format_path(path); const struct mg_callbacks callbacks = { @@ -176,7 +188,7 @@ celix_status_t endpointDiscoveryServer_create(discovery_pt discovery, bundle_con } - } while(((*server)->ctx == NULL) && (port_counter < MAX_NUMBER_OF_RESTARTS)); + } while(((*server)->ctx == NULL) && (port_counter < max_ep_num)); (*server)->port = strdup(port);