Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 27E0D19821 for ; Tue, 19 Apr 2016 18:16:33 +0000 (UTC) Received: (qmail 51352 invoked by uid 500); 19 Apr 2016 18:16:33 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 51322 invoked by uid 500); 19 Apr 2016 18:16:33 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 51313 invoked by uid 99); 19 Apr 2016 18:16:33 -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; Tue, 19 Apr 2016 18:16:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BC8AEDFC13; Tue, 19 Apr 2016 18:16:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gmurthy@apache.org To: commits@qpid.apache.org Message-Id: <49557ef534074408aa3095237ca62eff@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: qpid-dispatch git commit: DISPATCH-261 - Added a new field called state to qd_config_listener_t so it can be checked before activating listeners Date: Tue, 19 Apr 2016 18:16:32 +0000 (UTC) Repository: qpid-dispatch Updated Branches: refs/heads/master b70f22600 -> 94e3c10a7 DISPATCH-261 - Added a new field called state to qd_config_listener_t so it can be checked before activating listeners Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/94e3c10a Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/94e3c10a Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/94e3c10a Branch: refs/heads/master Commit: 94e3c10a735515e564dfabd1ef1be0653af0e849 Parents: b70f226 Author: Ganesh Murthy Authored: Mon Apr 18 16:10:28 2016 -0400 Committer: Ganesh Murthy Committed: Tue Apr 19 14:15:24 2016 -0400 ---------------------------------------------------------------------- src/connection_manager.c | 16 ++++++++++++---- src/server_private.h | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/94e3c10a/src/connection_manager.c ---------------------------------------------------------------------- diff --git a/src/connection_manager.c b/src/connection_manager.c index 5c338b9..44a22a9 100644 --- a/src/connection_manager.c +++ b/src/connection_manager.c @@ -30,10 +30,11 @@ #include struct qd_config_listener_t { - bool is_connector; - DEQ_LINKS(qd_config_listener_t); + bool is_connector; + qd_bind_state_t state; qd_listener_t *listener; qd_server_config_t configuration; + DEQ_LINKS(qd_config_listener_t); }; DEQ_DECLARE(qd_config_listener_t, qd_config_listener_list_t); @@ -202,6 +203,7 @@ qd_config_listener_t *qd_dispatch_configure_listener(qd_dispatch_t *qd, qd_entit qd_connection_manager_t *cm = qd->connection_manager; qd_config_listener_t *cl = NEW(qd_config_listener_t); cl->is_connector = false; + cl->state = QD_BIND_NONE; cl->listener = 0; if (load_server_config(qd, &cl->configuration, entity) != QD_ERROR_NONE) { qd_log(cm->log_source, QD_LOG_ERROR, "Unable to create config listener: %s", qd_error_message()); @@ -300,8 +302,14 @@ void qd_connection_manager_start(qd_dispatch_t *qd) qd_config_connector_t *cc = DEQ_HEAD(qd->connection_manager->config_connectors); while (cl) { - if (cl->listener == 0) - cl->listener = qd_server_listen(qd, &cl->configuration, cl); + if (cl->listener == 0 ) + if (cl->state == QD_BIND_NONE) { //Try to start listening only if we have never tried to listen on that port before + cl->listener = qd_server_listen(qd, &cl->configuration, cl); + if (cl->listener && cl->listener->pn_listener) + cl->state = QD_BIND_SUCCESSFUL; + else + cl->state = QD_BIND_FAILED; + } cl = DEQ_NEXT(cl); } http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/94e3c10a/src/server_private.h ---------------------------------------------------------------------- diff --git a/src/server_private.h b/src/server_private.h index 0a8d701..6a9bb76 100644 --- a/src/server_private.h +++ b/src/server_private.h @@ -39,6 +39,12 @@ void qd_server_timer_cancel_LH(qd_timer_t *timer); #define CONTEXT_UNSPECIFIED_OWNER -2 typedef enum { + QD_BIND_SUCCESSFUL, // Bind to socket was attempted and the bind succeeded + QD_BIND_FAILED, // Bind to socket was attempted and bind failed + QD_BIND_NONE, // Bind to socket not attempted yet +} qd_bind_state_t; + +typedef enum { CXTR_STATE_CONNECTING = 0, CXTR_STATE_OPEN, CXTR_STATE_FAILED --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org