[qpid-dispatch] branch main updated: DISPATCH-1956: log.c rewrite to reduce locking scope This closes #1376
This is an automated email from the ASF dual-hosted git repository. mgoulish pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git The following commit(s) were added to refs/heads/main by this push: new 9416478 DISPATCH-1956: log.c rewrite to reduce locking scope This closes #1376 9416478 is described below commit 94164788cebf38d28b4213f5977cac1d62933ad4 Author: mgoulish AuthorDate: Thu Oct 14 11:26:24 2021 -0400 DISPATCH-1956: log.c rewrite to reduce locking scope This closes #1376 --- include/qpid/dispatch/log.h | 17 + src/log.c | 31 +-- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/include/qpid/dispatch/log.h b/include/qpid/dispatch/log.h index 6265029..5a65f68 100644 --- a/include/qpid/dispatch/log.h +++ b/include/qpid/dispatch/log.h @@ -27,14 +27,15 @@ /** Logging levels */ typedef enum { -QD_LOG_NONE =0x00, ///< No logging -QD_LOG_TRACE=0x01, ///< High volume messages, o(n) or more for n message transfers. -QD_LOG_DEBUG=0x02, ///< Debugging messages useful to developers. -QD_LOG_INFO =0x04, ///< Information messages useful to users -QD_LOG_NOTICE =0x08, ///< Notice of important but non-error events. -QD_LOG_WARNING =0x10, ///< Warning of event that may be a problem. -QD_LOG_ERROR=0x20, ///< Error, definitely a problem -QD_LOG_CRITICAL =0x40, ///< Critical error, data loss or process shut-down. +QD_LOG_NONE =0x00, ///< No logging +QD_LOG_TRACE =0x01, ///< High volume messages, o(n) or more for n message transfers. +QD_LOG_DEBUG =0x02, ///< Debugging messages useful to developers. +QD_LOG_INFO =0x04, ///< Information messages useful to users +QD_LOG_NOTICE=0x08, ///< Notice of important but non-error events. +QD_LOG_WARNING =0x10, ///< Warning of event that may be a problem. +QD_LOG_ERROR =0x20, ///< Error, definitely a problem +QD_LOG_CRITICAL =0x40, ///< Critical error, data loss or process shut-down. +QD_LOG_UNDEFINED =0x7FFF, ///< No log level defined, so none will be masked out. } qd_log_level_t; typedef struct qd_log_source_t qd_log_source_t; diff --git a/src/log.c b/src/log.c index 5599483..3262bdb 100644 --- a/src/log.c +++ b/src/log.c @@ -43,6 +43,7 @@ #define LOG_MAX (QD_LOG_TEXT_MAX+128) #define LIST_MAX 1000 + // log.c lock strategy // // log sources -- @@ -214,7 +215,7 @@ typedef enum {DEFAULT, NONE, TRACE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICA struct qd_log_source_t { DEQ_LINKS(qd_log_source_t); char *module; -int mask; +sys_atomic_t mask; int includeTimestamp; /* boolean or -1 means not set */ int includeSource; /* boolean or -1 means not set */ bool syslog; @@ -237,7 +238,7 @@ typedef struct level_t { #define LEVEL(name, QD_LOG, SYSLOG) { name, QD_LOG, ALL_BITS & ~(QD_LOG-1), SYSLOG } static level_t levels[] = { -{"default", -1, -1, 0}, +{"default", QD_LOG_UNDEFINED, QD_LOG_UNDEFINED, 0}, {"none", 0, 0, 0}, LEVEL("trace",QD_LOG_TRACE, LOG_DEBUG), /* syslog has no trace level */ LEVEL("debug",QD_LOG_DEBUG, LOG_DEBUG), @@ -273,7 +274,7 @@ static const level_t *level_for_name(const char *name, int len) { } /* - Return -1 and set qd_error if not a valid bit. + Return undefined and set qd_error if not a valid bit. Translate so that the min valid level index is 0. */ static int level_index_for_bit(int bit) { @@ -285,7 +286,7 @@ static int level_index_for_bit(int bit) { } qd_error(QD_ERROR_CONFIG, "'%d' is not a valid log level bit.", bit); -return -1; +return QD_LOG_UNDEFINED; } /// Return the name of log level or 0 if not found. @@ -383,7 +384,7 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry) /// Reset the log source to the default state static void qd_log_source_defaults(qd_log_source_t *src) { -src->mask = -1; +sys_atomic_set(&src->mask, (uint32_t) QD_LOG_UNDEFINED); src->includeTimestamp = -1; src->includeSource = -1; log_sink_decref(src->sink); @@ -419,8 +420,11 @@ static void qd_log_source_free(qd_log_source_t *src) { bool qd_log_enabled(qd_log_source_t *source, qd_log_level_t level) { if (!source) return false; -int mask = source->mask == -1 ? default_log_source->mask : source->mask; -return level & mask; +uint32_t mask = sys_atomic_get(&source->mask); +if (mask == QD_LOG_UNDEFINED) { +mask = sys_atomic_get(&default_log_source->mask); +} +return !!(level & mask); } void qd_vlog_impl(q
[qpid-dispatch] branch main updated: log.c rewrite part two DISPATCH-2133: qd_log_enabled() race This closes #1366
This is an automated email from the ASF dual-hosted git repository. mgoulish pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git The following commit(s) were added to refs/heads/main by this push: new 5be2067 log.c rewrite part two DISPATCH-2133: qd_log_enabled() race This closes #1366 5be2067 is described below commit 5be2067c1dc28378e56acd5806f25159cf3a14a5 Author: mgoulish AuthorDate: Fri Sep 24 12:49:50 2021 -0400 log.c rewrite part two DISPATCH-2133: qd_log_enabled() race This closes #1366 --- src/log.c | 259 +++- tests/tsan.supp | 2 +- 2 files changed, 146 insertions(+), 115 deletions(-) diff --git a/src/log.c b/src/log.c index e032bf6..5599483 100644 --- a/src/log.c +++ b/src/log.c @@ -26,6 +26,7 @@ #include "entity_cache.h" #include "log_private.h" #include "server_private.h" +#include "schema_enum.h" #include "qpid/dispatch/alloc.h" #include "qpid/dispatch/atomic.h" @@ -42,6 +43,35 @@ #define LOG_MAX (QD_LOG_TEXT_MAX+128) #define LIST_MAX 1000 +// log.c lock strategy +// +// log sources -- +// 1. Log sources are created only at initialize time, +//and are freed only during finalize time, so the +//list itself does not need to be protected by a +//lock. +// +// 2. Individual log sources do need protection, though, +//because a management command may call qd_log_entity() +//at any time, which may replace the log sink. So each +//log source has its own lock, to prevent collisions +//between write_log() and qd_log_entity(). +// +// log sinks --- +// 1. There is a global list of log sinks, which may be +//added to and deleted from at any time by qd_log_entity(). +//So there is a lock to protect the sinks list from +//simultaneous additions and deletions. +// +// log entries - +// 1. There is a global list of the most recent log entries +//that may be added to at any time by any log source. +//The list is bounded, so after some point additions +//cause deletions. +//So there is another lock to protect this entries lis +//from simultaneous access. +// +//= const char *QD_LOG_STATS_TYPE = "logStats"; static qd_log_source_t *default_log_source=0; @@ -49,7 +79,6 @@ static qd_log_source_t *default_log_source=0; int qd_log_max_len() { return TEXT_MAX; } typedef struct qd_log_entry_t qd_log_entry_t; - struct qd_log_entry_t { DEQ_LINKS(qd_log_entry_t); char *module; @@ -59,14 +88,13 @@ struct qd_log_entry_t { struct timeval time; chartext[TEXT_MAX]; }; - ALLOC_DECLARE(qd_log_entry_t); ALLOC_DEFINE(qd_log_entry_t); - DEQ_DECLARE(qd_log_entry_t, qd_log_list_t); static qd_log_list_t entries = {0}; +sys_mutex_t *entries_lock = 0; -static void qd_log_entry_free_lh(qd_log_entry_t* entry) { +static void qd_log_entry_free_lh(qd_log_entry_t *entry) { DEQ_REMOVE(entries, entry); free(entry->file); free(entry->module); @@ -81,11 +109,9 @@ typedef struct log_sink_t { FILE *file; DEQ_LINKS(struct log_sink_t); } log_sink_t; - -DEQ_DECLARE(log_sink_t, log_sink_list_t); - -static sys_mutex_t *log_sink_list_lock = 0; -static log_sink_list_t sink_list = {0}; +DEQ_DECLARE(log_sink_t, log_sinks_t); +static sys_mutex_t *log_sinks_lock = 0; +static log_sinks_t sink_list = {0}; const char *format = "%Y-%m-%d %H:%M:%S.%%06lu %z"; bool utc = false; @@ -111,9 +137,11 @@ static const char* SINK_STDERR = "stderr"; static const char* SINK_SYSLOG = "syslog"; static const char* SOURCE_DEFAULT = "DEFAULT"; +// Hold the log_sinks_lock to prevent collision +// with log_sink(). static void log_sink_decref(const log_sink_t *sink) { if (!sink) return; -sys_mutex_lock(log_sink_list_lock); +sys_mutex_lock(log_sinks_lock); assert(sink->ref_count); log_sink_t *mutable_sink = (log_sink_t *)sink; @@ -127,12 +155,14 @@ static void log_sink_decref(const log_sink_t *sink) { closelog(); free(mutable_sink); } -sys_mutex_unlock(log_sink_list_lock); +sys_mutex_unlock(log_sinks_lock); } -static const log_sink_t* log_sink(const char* name) { -sys_mutex_lock(log_sink_list_lock); -log_sink_t* sink = DEQ_HEAD(sink_list); +// Hold the log_sinks_lock to prevent collision +// with log_sink_decref(). +static const log_sink_t *log_sink(const char *name) { +sys_mutex_lock(log_sinks_lock); +log_sink_t *sink = DEQ_HEAD(sink_list); DEQ_FIND(sink, strcmp(sink->name, name) == 0); if (sink) { @@ -156,11 +186,8 @@ stat
[qpid-dispatch] branch main updated: DISPATCH-1956: Changes to sink-side only This closes #1311
This is an automated email from the ASF dual-hosted git repository. mgoulish pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git The following commit(s) were added to refs/heads/main by this push: new 25360c6 DISPATCH-1956: Changes to sink-side only This closes #1311 25360c6 is described below commit 25360c6cf6655e85cfb521e0c475b8a6a12bc592 Author: mgoulish AuthorDate: Wed Jul 21 07:59:40 2021 -0400 DISPATCH-1956: Changes to sink-side only This closes #1311 --- src/log.c | 66 +++ 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/src/log.c b/src/log.c index cac7fbd..e032bf6 100644 --- a/src/log.c +++ b/src/log.c @@ -84,6 +84,7 @@ typedef struct log_sink_t { DEQ_DECLARE(log_sink_t, log_sink_list_t); +static sys_mutex_t *log_sink_list_lock = 0; static log_sink_list_t sink_list = {0}; const char *format = "%Y-%m-%d %H:%M:%S.%%06lu %z"; @@ -110,30 +111,30 @@ static const char* SINK_STDERR = "stderr"; static const char* SINK_SYSLOG = "syslog"; static const char* SOURCE_DEFAULT = "DEFAULT"; -static log_sink_t* find_log_sink_lh(const char* name) { -log_sink_t* sink = DEQ_HEAD(sink_list); -DEQ_FIND(sink, strcmp(sink->name, name) == 0); -return sink; -} - -// Must hold the log_source_lock -static void log_sink_free_lh(log_sink_t* sink) { +static void log_sink_decref(const log_sink_t *sink) { if (!sink) return; +sys_mutex_lock(log_sink_list_lock); assert(sink->ref_count); -if (sys_atomic_dec(&sink->ref_count) == 1) { -DEQ_REMOVE(sink_list, sink); -free(sink->name); -if (sink->file && sink->file != stderr) -fclose(sink->file); -if (sink->syslog) +log_sink_t *mutable_sink = (log_sink_t *)sink; + +if (sys_atomic_dec(&mutable_sink->ref_count) == 1) { +DEQ_REMOVE(sink_list, mutable_sink); +free(mutable_sink->name); +if (mutable_sink->file && mutable_sink->file != stderr) +fclose(mutable_sink->file); +if (mutable_sink->syslog) closelog(); -free(sink); +free(mutable_sink); } +sys_mutex_unlock(log_sink_list_lock); } -static log_sink_t* log_sink_lh(const char* name) { -log_sink_t* sink = find_log_sink_lh(name); +static const log_sink_t* log_sink(const char* name) { +sys_mutex_lock(log_sink_list_lock); +log_sink_t* sink = DEQ_HEAD(sink_list); +DEQ_FIND(sink, strcmp(sink->name, name) == 0); + if (sink) { sys_atomic_inc(&sink->ref_count); } @@ -155,12 +156,11 @@ static log_sink_t* log_sink_lh(const char* name) { file = fopen(name, "a"); } - - //If file is not there, return 0. // We are not logging an error here since we are already holding the log_source_lock // Writing a log message will try to re-obtain the log_source_lock lock and cause a deadlock. if (!file && !syslog) { +sys_mutex_unlock(log_sink_list_lock); return 0; } @@ -173,7 +173,8 @@ static log_sink_t* log_sink_lh(const char* name) { DEQ_INSERT_TAIL(sink_list, sink); } -return sink; +sys_mutex_unlock(log_sink_list_lock); +return (const log_sink_t *)sink; } @@ -190,7 +191,7 @@ struct qd_log_source_t { int includeTimestamp; /* boolean or -1 means not set */ int includeSource; /* boolean or -1 means not set */ bool syslog; -log_sink_t *sink; +const log_sink_t *sink; uint64_t severity_histogram[N_LEVEL_INDICES]; }; @@ -305,8 +306,13 @@ static bool default_bool(int value, int default_value) { static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry) { -log_sink_t* sink = log_source->sink ? log_source->sink : default_log_source->sink; -if (!sink) return; +// Don't let the sink list change while we are writing to one of them. +sys_mutex_lock(log_sink_list_lock); +const log_sink_t* sink = log_source->sink ? log_source->sink : default_log_source->sink; +if (!sink) { +sys_mutex_unlock(log_sink_list_lock); +return; +} char log_str[LOG_MAX]; char *begin = log_str; @@ -339,7 +345,6 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry) char msg[TEXT_MAX]; snprintf(msg, sizeof(msg), "Cannot write log output to '%s'", sink->name); perror(msg); -exit(1); }; fflush(sink->file); } @@ -348,6 +353,7 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry) if (syslog_level != -1) syslog(syslog_level, "%s", log_str); } +sys_mutex_unlock(log_sink_
qpid-dispatch git commit: DISPATCH-1139 : no need for priority field in query struct.
Repository: qpid-dispatch Updated Branches: refs/heads/master bad912142 -> 57347bea6 DISPATCH-1139 : no need for priority field in query struct. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/57347bea Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/57347bea Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/57347bea Branch: refs/heads/master Commit: 57347bea6e143a58209dcf90865888fd1989b6c0 Parents: bad9121 Author: mgoulish Authored: Thu Oct 18 13:33:43 2018 -0400 Committer: mgoulish Committed: Thu Oct 18 13:33:43 2018 -0400 -- src/router_core/router_core_private.h | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/57347bea/src/router_core/router_core_private.h -- diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h index ab5e985..b5e354a 100644 --- a/src/router_core/router_core_private.h +++ b/src/router_core/router_core_private.h @@ -284,7 +284,6 @@ struct qdr_query_t { int next_offset; bool more; qd_amqp_error_t status; -uint8_t priority; }; DEQ_DECLARE(qdr_query_t, qdr_query_list_t); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-dispatch git commit: DISPATCH-947 : fix tests broken by de-Messengerization of other tests
Repository: qpid-dispatch Updated Branches: refs/heads/master 9b07c2d69 -> cbbefa77f DISPATCH-947 : fix tests broken by de-Messengerization of other tests Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/cbbefa77 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/cbbefa77 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/cbbefa77 Branch: refs/heads/master Commit: cbbefa77fb6ae5da6dd881eb201b3501180e69d8 Parents: 9b07c2d Author: mgoulish Authored: Thu Mar 29 11:27:08 2018 -0400 Committer: mgoulish Committed: Thu Mar 29 11:27:08 2018 -0400 -- tests/system_tests_one_router.py | 56 +-- 1 file changed, 33 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/cbbefa77/tests/system_tests_one_router.py -- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index 6703906..9e42451 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -290,11 +290,9 @@ class OneRouterTest(TestCase): self.assertEqual(None, test.error) def test_27_released_vs_modified(self): -pass -# hanging 2018_03_28 -#test = ReleasedVsModifiedTest(self.address) -#test.run() -#self.assertEqual(None, test.error) +test = ReleasedVsModifiedTest(self.address) +test.run() +self.assertEqual(None, test.error) def test_28_appearance_of_balance(self): test = AppearanceOfBalanceTest(self.address) @@ -333,12 +331,10 @@ class OneRouterTest(TestCase): self.assertTrue(test.passed) def test_35_reject_disposition(self): -pass -# failing 2018_03_28 -# test = RejectDispositionTest(self.address) -# test.run() -# self.assertTrue(test.received_error) -# self.assertTrue(test.reject_count_match) +test = RejectDispositionTest(self.address) +test.run() +self.assertTrue(test.received_error) +self.assertTrue(test.reject_count_match) def test_36_query_router(self): """ @@ -2397,14 +2393,22 @@ class ReleasedVsModifiedTest(MessagingHandler): self.n_received = 0 self.n_released = 0 self.n_modified = 0 +self.node_modified_at_start = 0 + +def get_modified_deliveries ( self ) : +local_node = Node.connect(self.address, timeout=TIMEOUT) +outs = local_node.query(type='org.apache.qpid.dispatch.routerStats') +pos = outs.attribute_names.index("modifiedDeliveries") +results = outs.results[0] +n_modified_deliveries = results [ pos ] +return n_modified_deliveries + def check_if_done(self): if self.n_received == self.accept and self.n_released == self.count - self.accept and self.n_modified == self.accept: -local_node = Node.connect(self.address, timeout=TIMEOUT) -outs = local_node.query(type='org.apache.qpid.dispatch.routerStats') -pos = outs.attribute_names.index("modifiedDeliveries") -results = outs.results[0] -if results[pos] == self.accept: +node_modified_now = self.get_modified_deliveries ( ) +this_test_modified_deliveries = node_modified_now - self.node_modified_at_start +if this_test_modified_deliveries == self.accept: self.timer.cancel() self.conn.close() @@ -2419,6 +2423,7 @@ class ReleasedVsModifiedTest(MessagingHandler): self.sender= event.container.create_sender(self.conn, self.dest) self.receiver = event.container.create_receiver(self.conn, self.dest, name="A") self.receiver.flow(self.accept) +self.node_modified_at_start = self.get_modified_deliveries ( ) def on_sendable(self, event): for i in range(self.count - self.n_sent): @@ -2691,11 +2696,20 @@ class RejectDispositionTest(MessagingHandler): self.error_description = 'you were out of luck this time!' self.error_name = u'amqp:internal-error' self.reject_count_match = False +self.rejects_at_start = 0 + +def count_rejects ( self ) : +local_node = Node.connect(self.address, timeout=TIMEOUT) +outs = local_node.query(type='org.apache.qpid.dispatch.routerStats') +pos = outs.attribute_names.index("rejectedDeliveries") +results = outs.results[0] +return results[pos] def on_start(self, event): conn = event.container.connect(self.address) event.container.create_send
qpid-dispatch git commit: DISPATCH-947 : de-Messengerize tests 14 and 15
Repository: qpid-dispatch Updated Branches: refs/heads/master 175cca432 -> f0a0a1371 DISPATCH-947 : de-Messengerize tests 14 and 15 Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/f0a0a137 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/f0a0a137 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/f0a0a137 Branch: refs/heads/master Commit: f0a0a137103532836618abe5ef027444fbf31a2c Parents: 175cca4 Author: mgoulish Authored: Wed Mar 28 21:32:09 2018 -0400 Committer: mgoulish Committed: Wed Mar 28 21:32:09 2018 -0400 -- tests/system_tests_one_router.py | 321 -- 1 file changed, 189 insertions(+), 132 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f0a0a137/tests/system_tests_one_router.py -- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index f475528..6703906 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -89,7 +89,7 @@ class OneRouterTest(TestCase): def test_01_listen_error(self): -"""Make sure a router exits if a initial listener fails, doesn't hang""" +# Make sure a router exits if a initial listener fails, doesn't hang. config = Qdrouterd.Config([ ('router', {'mode': 'standalone', 'id': 'bad'}), ('listener', {'port': OneRouterTest.listen_port})]) @@ -191,7 +191,8 @@ class OneRouterTest(TestCase): # Dont send any pre-existing ingress or trace annotations. Make sure that there -# are no outgoing message annotations stripAnnotations property is set to "both" +# are no outgoing message annotations stripAnnotations property is set to "both". +# Custom annotations, however, are not stripped. def test_13_test_strip_message_annotations_both(self): addr = self.both_strip_addr + "/strip_message_annotations_both/1" test = StripMessageAnnotationsBoth ( addr, n_messages = 10 ) @@ -199,151 +200,61 @@ class OneRouterTest(TestCase): self.assertEqual ( None, test.error ) -# Dont send any pre-existing ingress or trace annotations. Send in a custom annotation. -# Make sure that the custom annotation comes out and nothing else. -# stripAnnotations property is set to "both" -def test_14_test_strip_message_annotations_both_custom(self): -addr = self.router.addresses[2]+"/strip_message_annotations_both/1" - -M1 = self.messenger() -M2 = self.messenger() - -M1.start() -M2.start() -M2.subscribe(addr) - -ingress_message = Message() -ingress_message.address = addr -ingress_message.body = {'message': 'Hello World!'} - -# Only annotations with prefix "x-opt-qd." will be stripped -ingress_message_annotations = {'stay': 'humble', 'x-opt-qd': 'work'} -ingress_message.annotations = ingress_message_annotations - -#Put and send the message -M1.put(ingress_message) -M1.send() - -# Receive the message -M2.recv(1) -egress_message = Message() -M2.get(egress_message) - -self.assertEqual(egress_message.annotations, ingress_message_annotations) - -M1.stop() -M2.stop() - - -#Dont send any pre-existing ingress or trace annotations. Make sure that there are no outgoing message annotations -#stripAnnotations property is set to "out" -def test_15_test_strip_message_annotations_out(self): -addr = self.router.addresses[3]+"/strip_message_annotations_out/1" - -M1 = self.messenger() -M2 = self.messenger() - -M1.start() -M2.start() -M2.subscribe(addr) - -ingress_message = Message() -ingress_message.address = addr -ingress_message.body = {'message': 'Hello World!'} - -#Put and send the message -M1.put(ingress_message) -M1.send() - -# Receive the message -M2.recv(1) -egress_message = Message() -M2.get(egress_message) - -self.assertEqual(egress_message.annotations, None) - -M1.stop() -M2.stop() - - -#Send in pre-existing trace and ingress and annotations and make sure that they are not in the outgoing annotations. -#stripAnnotations property is set to "in" -def test_16_test_strip_message_annotations_in(self): -
qpid-dispatch git commit: DISPATCH-947 : de-Messengerize tests 11-13
Repository: qpid-dispatch Updated Branches: refs/heads/master 95165f310 -> 175cca432 DISPATCH-947 : de-Messengerize tests 11-13 Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/175cca43 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/175cca43 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/175cca43 Branch: refs/heads/master Commit: 175cca432ddfe464d98750929b2b6c2e4b147e79 Parents: 95165f3 Author: mgoulish Authored: Wed Mar 28 16:33:27 2018 -0400 Committer: mgoulish Committed: Wed Mar 28 16:33:27 2018 -0400 -- tests/system_tests_one_router.py | 377 -- 1 file changed, 270 insertions(+), 107 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/175cca43/tests/system_tests_one_router.py -- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index fc81cff..f475528 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -82,6 +82,12 @@ class OneRouterTest(TestCase): cls.address = cls.router.addresses[0] cls.closest_count = 1 +cls.no_strip_addr = cls.router.addresses[1] +cls.both_strip_addr = cls.router.addresses[2] +cls.out_strip_addr = cls.router.addresses[3] +cls.in_strip_addr = cls.router.addresses[4] + + def test_01_listen_error(self): """Make sure a router exits if a initial listener fails, doesn't hang""" config = Qdrouterd.Config([ @@ -161,126 +167,36 @@ class OneRouterTest(TestCase): # This test will test the stripAnnotations = no option - meaning no annotations must be stripped. # We will send in a custom annotation and make sure that we get back 3 annotations on the received message def test_10_strip_message_annotations_custom(self): -addr = self.address + '/closest/' + str(OneRouterTest.closest_count) +addr = self.no_strip_addr + "/strip_message_annotations_no_custom/1" OneRouterTest.closest_count += 1 test = StripMessageAnnotationsCustom ( addr, n_messages = 10 ) test.run ( ) self.assertEqual ( None, test.error ) -# stripAnnotations property is set to "no" -def test_11_test_strip_message_annotations_no(self): -addr = self.router.addresses[1]+"/strip_message_annotations_no/1" - -M1 = self.messenger() -M2 = self.messenger() - -M1.start() -M2.start() -M2.subscribe(addr) - -ingress_message = Message() -ingress_message.address = addr -ingress_message.body = {'message': 'Hello World!'} -ingress_message_annotations = {} - -ingress_message.annotations = ingress_message_annotations - -M1.put(ingress_message) -M1.send() - -# Receive the message -M2.recv(1) -egress_message = Message() -M2.get(egress_message) - -#Make sure 'Hello World!' is in the message body dict -self.assertEqual('Hello World!', egress_message.body['message']) - -egress_message_annotations = egress_message.annotations -self.assertEqual(egress_message_annotations.__class__, dict) -self.assertEqual(egress_message_annotations['x-opt-qd.ingress'], '0/QDR') -self.assertEqual(egress_message_annotations['x-opt-qd.trace'], ['0/QDR']) - -M1.stop() -M2.stop() +# stripAnnotations property is set to "no" +def test_11_test_strip_message_annotations_no(self): +addr = self.no_strip_addr + "/strip_message_annotations_no/1" +test = StripMessageAnnotationsNo ( addr, n_messages = 10 ) +test.run ( ) +self.assertEqual ( None, test.error ) # stripAnnotations property is set to "no" def test_12_test_strip_message_annotations_no_add_trace(self): -addr = self.router.addresses[1]+"/strip_message_annotations_no_add_trace/1" - -M1 = self.messenger() -M2 = self.messenger() - -M1.start() -M2.start() -M2.subscribe(addr) - -ingress_message = Message() -ingress_message.address = addr -ingress_message.body = {'message': 'Hello World!'} - -# -# Pre-existing ingress and trace -# -ingress_message_annotations = {'x-opt-qd.ingress': 'ingress-router', - 'x-opt-qd.trace': ['0/QDR.1'], -
qpid-dispatch git commit: DISPATCH-947 : de-Messenger test_10
Repository: qpid-dispatch Updated Branches: refs/heads/master 0dad431bd -> 1340f2b85 DISPATCH-947 : de-Messenger test_10 Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/1340f2b8 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/1340f2b8 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/1340f2b8 Branch: refs/heads/master Commit: 1340f2b85bc95d841fa7a6e1de45e643547f970d Parents: 0dad431 Author: mgoulish Authored: Wed Mar 28 11:28:13 2018 -0400 Committer: mgoulish Committed: Wed Mar 28 11:28:13 2018 -0400 -- tests/system_tests_one_router.py | 111 ++ 1 file changed, 72 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1340f2b8/tests/system_tests_one_router.py -- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index 7131e00..284f8e7 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -159,46 +159,13 @@ class OneRouterTest(TestCase): # There is a property in qdrouter.json called stripAnnotations with possible values of ["in", "out", "both", "no"] # The default for stripAnnotations is "both" (which means strip annotations on both ingress and egress) # This test will test the stripAnnotations = no option - meaning no annotations must be stripped. -# We will send in a custom annotation and make that we get back 3 annotations on the received message +# We will send in a custom annotation and make sure that we get back 3 annotations on the received message def test_10_strip_message_annotations_custom(self): -addr = self.router.addresses[1]+"/strip_message_annotations_no_custom/1" - -M1 = self.messenger() -M2 = self.messenger() - -M1.start() -M2.start() -M2.subscribe(addr) - -ingress_message = Message() -ingress_message.address = addr -ingress_message.body = {'message': 'Hello World!'} -ingress_message_annotations = {} -ingress_message_annotations['custom-annotation'] = '1/Custom_Annotation' - -ingress_message.annotations = ingress_message_annotations - -M1.put(ingress_message) -M1.send() - -# Receive the message -M2.recv(1) -egress_message = Message() -M2.get(egress_message) - -# Make sure 'Hello World!' is in the message body dict -self.assertEqual('Hello World!', egress_message.body['message']) - -egress_message_annotations = egress_message.annotations - -self.assertEqual(egress_message_annotations.__class__, dict) -self.assertEqual(egress_message_annotations['custom-annotation'], '1/Custom_Annotation') -self.assertEqual(egress_message_annotations['x-opt-qd.ingress'], '0/QDR') -self.assertEqual(egress_message_annotations['x-opt-qd.trace'], ['0/QDR']) - -M1.stop() -M2.stop() - +addr = self.address + '/closest/' + str(OneRouterTest.closest_count) +OneRouterTest.closest_count += 1 +test = StripMessageAnnotationsCustom ( addr, n_messages = 10 ) +test.run ( ) +self.assertEqual ( None, test.error ) # stripAnnotations property is set to "no" def test_11_test_strip_message_annotations_no(self): @@ -1671,6 +1638,72 @@ class MessageAnnotations ( MessagingHandler ) : +class StripMessageAnnotationsCustom ( MessagingHandler ) : +def __init__ ( self, + addr, + n_messages + ) : +super ( StripMessageAnnotationsCustom, self ) . __init__ ( prefetch = n_messages ) +self.addr= addr +self.n_messages = n_messages + +self.test_timer = None +self.sender = None +self.receiver= None +self.n_sent = 0 +self.n_received = 0 + + +def run ( self ) : +Container(self).run() + + +def bail ( self, travail ) : +self.bailing = True +self.error = travail +self.send_conn.close ( ) +self.recv_conn.close ( ) +self.test_timer.cancel ( ) + + +def timeout ( self, name ): +self.bail ( "Timeout Expired" ) + + +def on_start ( self, event ): +self.send_conn = event.container.connect ( self.addr ) +self.recv_conn = event.container.connect ( self.addr ) + +self.sender = event.container.create_sender ( self.send_conn, self.
[2/2] qpid-dispatch git commit: DISPATCH-947 : de-Messenger first 9 Messenger tests.
DISPATCH-947 : de-Messenger first 9 Messenger tests. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/a5da7488 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/a5da7488 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/a5da7488 Branch: refs/heads/master Commit: a5da7488b1a6d22293dedd2ddbf9728d42322f6f Parents: 968d0fd Author: mgoulish Authored: Wed Mar 28 10:13:08 2018 -0400 Committer: mgoulish Committed: Wed Mar 28 10:13:08 2018 -0400 -- tests/system_tests_one_router.py | 591 +- 1 file changed, 576 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/a5da7488/tests/system_tests_one_router.py -- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index c75c2fc..f27a8d6 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -161,67 +161,628 @@ class OneRouterTest(TestCase): # This test will test the stripAnnotations = no option - meaning no annotations must be stripped. # We will send in a custom annotation and make that we get back 3 annotations on the received message def test_10_strip_message_annotations_custom(self): -pass +addr = self.router.addresses[1]+"/strip_message_annotations_no_custom/1" + +M1 = self.messenger() +M2 = self.messenger() + +M1.start() +M2.start() +M2.subscribe(addr) + +ingress_message = Message() +ingress_message.address = addr +ingress_message.body = {'message': 'Hello World!'} +ingress_message_annotations = {} +ingress_message_annotations['custom-annotation'] = '1/Custom_Annotation' + +ingress_message.annotations = ingress_message_annotations + +M1.put(ingress_message) +M1.send() + +# Receive the message +M2.recv(1) +egress_message = Message() +M2.get(egress_message) + +# Make sure 'Hello World!' is in the message body dict +self.assertEqual('Hello World!', egress_message.body['message']) + +egress_message_annotations = egress_message.annotations + +self.assertEqual(egress_message_annotations.__class__, dict) +self.assertEqual(egress_message_annotations['custom-annotation'], '1/Custom_Annotation') +self.assertEqual(egress_message_annotations['x-opt-qd.ingress'], '0/QDR') +self.assertEqual(egress_message_annotations['x-opt-qd.trace'], ['0/QDR']) + +M1.stop() +M2.stop() + # stripAnnotations property is set to "no" def test_11_test_strip_message_annotations_no(self): -pass +addr = self.router.addresses[1]+"/strip_message_annotations_no/1" + +M1 = self.messenger() +M2 = self.messenger() + +M1.start() +M2.start() +M2.subscribe(addr) + +ingress_message = Message() +ingress_message.address = addr +ingress_message.body = {'message': 'Hello World!'} +ingress_message_annotations = {} + +ingress_message.annotations = ingress_message_annotations + +M1.put(ingress_message) +M1.send() + +# Receive the message +M2.recv(1) +egress_message = Message() +M2.get(egress_message) + +#Make sure 'Hello World!' is in the message body dict +self.assertEqual('Hello World!', egress_message.body['message']) + +egress_message_annotations = egress_message.annotations + +self.assertEqual(egress_message_annotations.__class__, dict) +self.assertEqual(egress_message_annotations['x-opt-qd.ingress'], '0/QDR') +self.assertEqual(egress_message_annotations['x-opt-qd.trace'], ['0/QDR']) + +M1.stop() +M2.stop() + # stripAnnotations property is set to "no" def test_12_test_strip_message_annotations_no_add_trace(self): -pass +addr = self.router.addresses[1]+"/strip_message_annotations_no_add_trace/1" + +M1 = self.messenger() +M2 = self.messenger() + +M1.start() +M2.start() +M2.subscribe(addr) + +ingress_message = Message() +ingress_message.address = addr +ingress_message.body = {'message': 'Hello World!'} + +# +# Pre-existing ingress and trace +# +ingress_message_annotations = {'x-opt-qd.ingre
[1/2] qpid-dispatch git commit: DISPATCH-947 -- re-wrote first 9 Messenger tests to not use Messenger
Repository: qpid-dispatch Updated Branches: refs/heads/master 77d2123b2 -> a5da7488b DISPATCH-947 -- re-wrote first 9 Messenger tests to not use Messenger Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/968d0fd0 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/968d0fd0 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/968d0fd0 Branch: refs/heads/master Commit: 968d0fd0fa76ee319c440724801c51295bd801f5 Parents: 77d2123 Author: mgoulish Authored: Wed Mar 28 09:08:57 2018 -0400 Committer: mgoulish Committed: Wed Mar 28 09:08:57 2018 -0400 -- tests/system_tests_one_router.py | 1756 +++-- 1 file changed, 776 insertions(+), 980 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/968d0fd0/tests/system_tests_one_router.py -- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index 18a273b..c75c2fc 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -18,10 +18,10 @@ # import unittest2 as unittest -from proton import Condition, Message, Delivery, PENDING, ACCEPTED, REJECTED, Url, symbol +from proton import Condition, Message, Delivery, PENDING, ACCEPTED, REJECTED, Url, symbol, Timeout from system_test import TestCase, Qdrouterd, main_module, TIMEOUT from proton.handlers import MessagingHandler, TransactionHandler -from proton.reactor import Container, AtMostOnce, AtLeastOnce +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector from proton.utils import BlockingConnection, SyncRequestResponse from qpid_dispatch.management.client import Node @@ -31,6 +31,24 @@ CONNECTION_PROPERTIES_SYMBOL[symbol("connection")] = symbol("properties") CONNECTION_PROPERTIES_BINARY = {'client_identifier': 'policy_server'} +# +# Helper classes for all tests. +# + + +# Named timers allow test code to distinguish between several +# simultaneous timers, going off at different rates. +class MultiTimeout ( object ): +def __init__(self, parent, name): +self.parent = parent +self.name = name + +def on_timer_task(self, event): +self.parent.timeout ( self.name ) + + + + class OneRouterTest(TestCase): """System tests involving a single router""" @classmethod @@ -62,8 +80,9 @@ class OneRouterTest(TestCase): cls.router = cls.tester.qdrouterd(name, config) cls.router.wait_ready() cls.address = cls.router.addresses[0] +cls.closest_count = 1 -def test_listen_error(self): +def test_01_listen_error(self): """Make sure a router exits if a initial listener fails, doesn't hang""" config = Qdrouterd.Config([ ('router', {'mode': 'standalone', 'id': 'bad'}), @@ -71,1015 +90,140 @@ class OneRouterTest(TestCase): r = Qdrouterd(name="expect_fail", config=config, wait=False) self.assertEqual(1, r.wait()) -def test_01_pre_settled(self): -addr = self.address+"/pre_settled/1" -M1 = self.messenger() -M2 = self.messenger() - -M1.start() -M2.start() -M2.subscribe(addr) - -tm = Message() -rm = Message() - -tm.address = addr -for i in range(100): -tm.body = {'number': i} -M1.put(tm) -M1.send() - -for i in range(100): -M2.recv(1) -M2.get(rm) -self.assertEqual(i, rm.body['number']) - -M1.stop() -M2.stop() - -def test_02a_multicast_unsettled(self): -addr = self.address+"/multicast.unsettled.1" -M1 = self.messenger() -M2 = self.messenger() -M3 = self.messenger() -M4 = self.messenger() - - -M1.outgoing_window = 5 -M2.incoming_window = 5 -M3.incoming_window = 5 -M4.incoming_window = 5 - -M1.start() -M2.start() -M3.start() -M4.start() - -M2.subscribe(addr) -M3.subscribe(addr) -M4.subscribe(addr) - -tm = Message() -rm = Message() - -tm.address = addr -for i in range(2): -tm.body = {'number': i} -M1.put(tm) -M1.send(0) - -for i in range(2): -M2.recv(1) -trk = M2.get(rm)
qpid-dispatch git commit: DISPATCH-209 : test disposition guarantee with spurious connection loss
Repository: qpid-dispatch Updated Branches: refs/heads/master 7e16c4e87 -> 35b1c3f83 DISPATCH-209 : test disposition guarantee with spurious connection loss Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/35b1c3f8 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/35b1c3f8 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/35b1c3f8 Branch: refs/heads/master Commit: 35b1c3f83427e4fefa19a701650f0b2a8f49185a Parents: 7e16c4e Author: mgoulish Authored: Wed Mar 7 03:36:02 2018 -0500 Committer: mgoulish Committed: Wed Mar 7 03:36:02 2018 -0500 -- tests/system_tests_topology_disposition.py | 440 +++- 1 file changed, 351 insertions(+), 89 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/35b1c3f8/tests/system_tests_topology_disposition.py -- diff --git a/tests/system_tests_topology_disposition.py b/tests/system_tests_topology_disposition.py index 03812ea..ba15009 100644 --- a/tests/system_tests_topology_disposition.py +++ b/tests/system_tests_topology_disposition.py @@ -42,9 +42,19 @@ except ImportError: -# +# # Helper classes for all tests. -# +# + +class Stopwatch ( object ) : + +def __init__ ( self, name, timer, initial_time, repeat_time ) : +self.name = name +self.timer= timer +self.initial_time = initial_time +self.repeat_time = repeat_time + + class Timeout(object): """ @@ -78,11 +88,11 @@ class ManagementMessageHelper ( object ) : return msg def make_router_link_query ( self ) : -props = { 'count': '100', - 'operation': 'QUERY', - 'entityType': 'org.apache.qpid.dispatch.router.link', - 'name': 'self', - 'type': 'org.amqp.management' +props = { 'count': '100', + 'operation': 'QUERY', + 'entityType': 'org.apache.qpid.dispatch.router.link', + 'name': 'self', + 'type': 'org.amqp.management' } attrs = [] attrs.append ( unicode('linkType') ) @@ -102,9 +112,10 @@ class ManagementMessageHelper ( object ) : return Message ( body=msg_body, properties=props, reply_to=self.reply_addr ) -# + +# # END Helper classes for all tests. -# +# @@ -114,13 +125,23 @@ class ManagementMessageHelper ( object ) : # Setup # + class TopologyDispositionTests ( TestCase ): +""" +The disposition guarantee is that the sender should shortly know +how its messages have been disposed: whether they have been +accepted, released, or modified. +These tests ensure that the disposition guarantee survives +disruptions in router network topology. +""" @classmethod def setUpClass(cls): super(TopologyDispositionTests, cls).setUpClass() +cls.routers = [] + def router(name, more_config): @@ -135,16 +156,17 @@ class TopologyDispositionTests ( TestCase ): cls.routers.append(cls.tester.qdrouterd(name, config, wait=True)) -cls.routers = [] -A_client_port = cls.tester.get_port() -B_client_port = cls.tester.get_port() -C_client_port = cls.tester.get_port() -D_client_port = cls.tester.get_port() +client_ports = dict() +client_ports [ 'A' ] = cls.tester.get_port() +client_ports [ 'B' ] = cls.tester.get_port() +client_ports [ 'C' ] = cls.tester.get_port() +client_ports [ 'D' ] = cls.tester.get_port() -A_inter_router_port = cls.tester.get_port() -B_inter_router_port = cls.tester.get_port() -C_inter_router_port = cls.tester.get_port() +inter_router_ports = dict() +inter_router_ports [ 'A' ] = cls.tester.get_port() +inter_router_ports [ 'B' ] = cls.tester.get_port() +inter_rou
qpid-dispatch git commit: DISPATCH-209 : ensure no dispositions lost
Repository: qpid-dispatch Updated Branches: refs/heads/master bb0093e92 -> 5691122fc DISPATCH-209 : ensure no dispositions lost Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/5691122f Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/5691122f Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/5691122f Branch: refs/heads/master Commit: 5691122fc23588e9a8d02db561f154fc4f4ed155 Parents: bb0093e Author: mgoulish Authored: Thu Mar 1 13:42:12 2018 -0500 Committer: mgoulish Committed: Thu Mar 1 13:42:12 2018 -0500 -- tests/system_tests_topology_addition.py | 113 +++ 1 file changed, 97 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5691122f/tests/system_tests_topology_addition.py -- diff --git a/tests/system_tests_topology_addition.py b/tests/system_tests_topology_addition.py index 9feab29..7132683 100644 --- a/tests/system_tests_topology_addition.py +++ b/tests/system_tests_topology_addition.py @@ -89,6 +89,10 @@ class TopologyAdditionTests ( TestCase ): cls.inter_router_ports['A'] = cls.tester.get_port() cls.inter_router_ports['B'] = cls.tester.get_port() +initial_cost = 10 +lower_cost = 8 +higher_cost = 12 + # Only routers A and B are set up initially by this class. # Routers C and D are started by the test itself. router_A_config = [ @@ -123,7 +127,7 @@ class TopologyAdditionTests ( TestCase ): 'role': 'inter-router', 'port': cls.inter_router_ports['A'], 'verifyHostName': 'no', - 'cost': 12, + 'cost': initial_cost, 'stripAnnotations': 'no' } ) @@ -141,6 +145,10 @@ class TopologyAdditionTests ( TestCase ): cls.B_addr = router_B.addresses[0] + +# The two connections that this router will make, AC and BC, +# will be lower cost than the direct AB route that the network +# already has. cls.router_C_config = [ ( 'listener', { 'port': client_ports['C'], @@ -153,7 +161,7 @@ class TopologyAdditionTests ( TestCase ): 'role': 'inter-router', 'port': cls.inter_router_ports['A'], 'verifyHostName': 'no', - 'cost': 5, + 'cost': lower_cost / 2, 'stripAnnotations': 'no', 'linkCapacity' : 1000 } @@ -163,13 +171,16 @@ class TopologyAdditionTests ( TestCase ): 'role': 'inter-router', 'port': cls.inter_router_ports['B'], 'verifyHostName': 'no', - 'cost': 5, + 'cost': lower_cost / 2, 'stripAnnotations': 'no', 'linkCapacity' : 1000 } ) ] +# The two connections that this router will make, AD and BD, +# will be higher cost than the other paths the networks already has +# available to get from A to B. cls.router_D_config = [ ( 'listener', { 'port': client_ports['D'], @@ -182,7 +193,7 @@ class TopologyAdditionTests ( TestCase ): 'role': 'inter-router', 'port': cls.inter_router_ports['A'], 'verifyHostName': 'no', - 'cost': 7, + 'cost': higher_cost / 2,
qpid-dispatch git commit: DISPATCH-209 : additive topology tests
Repository: qpid-dispatch Updated Branches: refs/heads/master 1134dbae4 -> 2a5633c43 DISPATCH-209 : additive topology tests Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/2a5633c4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/2a5633c4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/2a5633c4 Branch: refs/heads/master Commit: 2a5633c431c1769ba45eb7d42a714e24c8f70ece Parents: 1134dba Author: mgoulish Authored: Wed Feb 28 11:58:30 2018 -0500 Committer: mgoulish Committed: Wed Feb 28 11:58:30 2018 -0500 -- tests/CMakeLists.txt| 1 + tests/system_tests_topology_addition.py | 466 +++ 2 files changed, 467 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2a5633c4/tests/CMakeLists.txt -- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1d4d1c8..ee55728 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -105,6 +105,7 @@ foreach(py_test_module system_tests_delivery_abort system_tests_topology system_tests_topology_disposition +system_tests_topology_addition ${SYSTEM_TESTS_HTTP} ) http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2a5633c4/tests/system_tests_topology_addition.py -- diff --git a/tests/system_tests_topology_addition.py b/tests/system_tests_topology_addition.py new file mode 100644 index 000..9feab29 --- /dev/null +++ b/tests/system_tests_topology_addition.py @@ -0,0 +1,466 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +import unittest, os, json +from subprocess import PIPE, STDOUT +from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout +from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process +from proton.handlers import MessagingHandler +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector +from proton.utilsimport BlockingConnection +from qpid_dispatch.management.client import Node + +import time +import datetime + + +# PROTON-828: +try: +from proton import MODIFIED +except ImportError: +from proton import PN_STATUS_MODIFIED as MODIFIED + + +# +# Helper classes for all tests. +# + + +# Named timers allow test code to distinguish between several +# simultaneous timers, going off at different rates. +class Timeout ( object ): +def __init__(self, parent, name): +self.parent = parent +self.name = name + +def on_timer_task(self, event): +self.parent.timeout ( self.name ) + + + +# +# Setup +# + +class TopologyAdditionTests ( TestCase ): + +@classmethod +def setUpClass(cls): +super(TopologyAdditionTests, cls).setUpClass() + +def router ( name, more_config ): + +config = [ ('router', {'mode': 'interior', 'id': name}), + ('address', {'prefix': 'closest', 'distribution': 'closest'}), + ('address', {'prefix': 'balanced', 'distribution': 'balanced'}), + ('address', {'prefix': 'multicast', 'distribution': 'multicast'}) + ] \ + + more_config + +config = Qdrouterd.Config(config) + +cls.routers.append(cls.tester.qdrouterd(name, config, wait=True)) + +cls.routers = [] + +client_por
qpid-dispatch git commit: DISPATCH-209 : test dispositions over changing topology
Repository: qpid-dispatch Updated Branches: refs/heads/master 22400df1f -> f256f675e DISPATCH-209 : test dispositions over changing topology Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/f256f675 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/f256f675 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/f256f675 Branch: refs/heads/master Commit: f256f675e63f17f3ade949033c14b93d4d6a146c Parents: 22400df Author: mgoulish Authored: Wed Feb 14 11:19:05 2018 -0500 Committer: mgoulish Committed: Wed Feb 14 11:19:05 2018 -0500 -- tests/CMakeLists.txt | 1 + tests/system_tests_topology_disposition.py | 817 2 files changed, 818 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f256f675/tests/CMakeLists.txt -- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0105c29..7312ba7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -103,6 +103,7 @@ foreach(py_test_module system_tests_authz_service_plugin system_tests_delivery_abort system_tests_topology +system_tests_topology_disposition ${SYSTEM_TESTS_HTTP} ) http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f256f675/tests/system_tests_topology_disposition.py -- diff --git a/tests/system_tests_topology_disposition.py b/tests/system_tests_topology_disposition.py new file mode 100644 index 000..03812ea --- /dev/null +++ b/tests/system_tests_topology_disposition.py @@ -0,0 +1,817 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +import unittest, os, json +from subprocess import PIPE, STDOUT +from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout +from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process +from proton.handlers import MessagingHandler +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector +from proton.utilsimport BlockingConnection +from qpid_dispatch.management.client import Node + +import time +import datetime +import pdb +import inspect + + + +# PROTON-828: +try: +from proton import MODIFIED +except ImportError: +from proton import PN_STATUS_MODIFIED as MODIFIED + + + + +# +# Helper classes for all tests. +# + +class Timeout(object): +""" +Named timeout object can handle multiple simultaneous +timers, by telling the parent which one fired. +""" +def __init__ ( self, parent, name ): +self.parent = parent +self.name = name + +def on_timer_task ( self, event ): +self.parent.timeout ( self.name ) + + + +class ManagementMessageHelper ( object ) : +""" +Format management messages. +""" +def __init__ ( self, reply_addr ) : +self.reply_addr = reply_addr + +def make_connector_query ( self, connector_name ) : +props = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name } +msg = Message ( properties=props, reply_to=self.reply_addr ) +return msg + +def make_connector_delete_command ( self, connector_name ) : +props = {'operation': 'DELETE', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name } +msg = Message ( properties=props, reply_to=self.reply_addr ) +return msg + +def make_router_link_query ( self ) : +props = { 'count': '100', + 'operation': 'QUERY', +
qpid-dispatch git commit: DISPATCH-209 : first topology test
Repository: qpid-dispatch Updated Branches: refs/heads/master e494da0a9 -> 58ecc97bc DISPATCH-209 : first topology test Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/58ecc97b Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/58ecc97b Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/58ecc97b Branch: refs/heads/master Commit: 58ecc97bcc3d9f89f62d308d3c9b01027151f5e3 Parents: e494da0 Author: mgoulish Authored: Wed Nov 29 11:49:59 2017 -0500 Committer: mgoulish Committed: Wed Nov 29 11:49:59 2017 -0500 -- tests/CMakeLists.txt | 1 + tests/system_tests_topology.py | 609 2 files changed, 610 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/58ecc97b/tests/CMakeLists.txt -- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index aaf65ec..0c6454c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -100,6 +100,7 @@ foreach(py_test_module system_tests_denied_unsettled_multicast system_tests_auth_service_plugin system_tests_delivery_abort +system_tests_topology ${SYSTEM_TESTS_HTTP} ) http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/58ecc97b/tests/system_tests_topology.py -- diff --git a/tests/system_tests_topology.py b/tests/system_tests_topology.py new file mode 100644 index 000..5e58483 --- /dev/null +++ b/tests/system_tests_topology.py @@ -0,0 +1,609 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +import unittest, os, json +from subprocess import PIPE, STDOUT +from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout +from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process +from proton.handlers import MessagingHandler +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector +from proton.utilsimport BlockingConnection +from qpid_dispatch.management.client import Node + +import time +import datetime +import pdb + + + +# PROTON-828: +try: +from proton import MODIFIED +except ImportError: +from proton import PN_STATUS_MODIFIED as MODIFIED + + + + +# +# Helper classes for all tests. +# + +class Timeout(object): +""" +Named timeout object can handle multiple simultaneous +timers, by telling the parent which one fired. +""" +def __init__ ( self, parent, name ): +self.parent = parent +self.name = name + +def on_timer_task ( self, event ): +self.parent.timeout ( self.name ) + + + +class ManagementMessageHelper ( object ): +""" +Format management messages. +""" +def __init__ ( self, reply_addr ): +self.reply_addr = reply_addr + +def make_connector_query ( self, connector_name ): +props = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name } +msg = Message ( properties=props, reply_to=self.reply_addr ) +return msg + +def make_connector_delete_command ( self, connector_name ): +props = {'operation': 'DELETE', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name } +msg = Message ( properties=props, reply_to=self.reply_addr ) +return msg + + +# +# END Helper classes for all tests. +# + + + + + +# +# Setup +#===
qpid-dispatch git commit: DISPATCH-209 : parallel waypoint test
Repository: qpid-dispatch Updated Branches: refs/heads/master 121e4065c -> c895d1c44 DISPATCH-209 : parallel waypoint test Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c895d1c4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c895d1c4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c895d1c4 Branch: refs/heads/master Commit: c895d1c440e9ad24d1ae4415f27e5f26ee26357e Parents: 121e406 Author: mick goulish Authored: Thu Oct 19 14:16:21 2017 -0400 Committer: mick goulish Committed: Thu Oct 19 14:16:21 2017 -0400 -- tests/system_tests_distribution.py | 883 +++- 1 file changed, 745 insertions(+), 138 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c895d1c4/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index 8084344..0156afc 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -121,8 +121,21 @@ class DistributionTests ( TestCase ): cls.linkroute_prefix = "0.0.0.0/linkroute" -cls.waypoint_prefix_1 = "0.0.0.0/queue_1" -cls.waypoint_prefix_2 = "0.0.0.0/queue_2" +cls.waypoint_prefix_1 = "0.0.0.0/process_1" +cls.waypoint_prefix_2 = "0.0.0.0/process_2" +cls.waypoint_prefix_3 = "0.0.0.0/process_3" + +#- +# Container IDs are what associate route containers +# with links -- for the linkroute tests and the +# waypoint tests. +#- +cls.container_ids = [ 'ethics_gradient', + 'honest_mistake', + 'frank_exchange_of_views', + 'zero_gravitas', + 'yawning_angel' +] #- # Here are some chunks of configuration that will be @@ -134,87 +147,160 @@ class DistributionTests ( TestCase ): ( 'linkRoute', { 'prefix': cls.linkroute_prefix, 'dir': 'in', -'containerId': 'LinkRouteTest' +'containerId': cls.container_ids[0] } ), ( 'linkRoute', { 'prefix': cls.linkroute_prefix, 'dir': 'out', -'containerId': 'LinkRouteTest' +'containerId': cls.container_ids[0] } ) ] -waypoint_configuration_1 =\ +single_waypoint_configuration =\ [ -( 'address', - { 'prefix': cls.waypoint_prefix_1, +( 'address', + { 'prefix': cls.waypoint_prefix_1, 'waypoint': 'yes' } ), -( 'autoLink', - { 'addr': cls.waypoint_prefix_1 + '.waypoint', -'containerId': 'WaypointTest', +( 'autoLink', + { 'addr': cls.waypoint_prefix_1 + '.waypoint', +'containerId': cls.container_ids[1], 'dir': 'in' } ), -( 'autoLink', +( 'autoLink', { 'addr': cls.waypoint_prefix_1 + '.waypoint', -'containerId': 'WaypointTest', +'containerId': cls.container_ids[1], 'dir': 'out' } ) ] -waypoint_configuration_2 = \ +#--- +# The phase-number is used by the router as an addition +# to the address for the link. To chain these two waypoints +# together in a serial fashion, we explicitly declare their +# phase numbers: +#Waypoint 1 +#out of router to process:phase 0 +#back from process to router: phase 1 +#Waypoint 2 +#out of router to process:phase 1 +#back from process to router: phase 2 +# +# Because of those two "phase 1" markings, messages coming back +# into the router from Waypoint 1 get routed back outbound to +# Waypoint 2. +# +# Because the address configuration specifies that phase 2 is +# the egress phase, messages coming into the router from that +# autolink are finally routed to the client receiver. +#--- +serial
qpid-dispatch git commit: DISPATCH-209 : single and serial waypoint tests
Repository: qpid-dispatch Updated Branches: refs/heads/master 69ee4b85f -> d9e328e50 DISPATCH-209 : single and serial waypoint tests Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/d9e328e5 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/d9e328e5 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/d9e328e5 Branch: refs/heads/master Commit: d9e328e505e14fd3105a6c68ee01d1d107e93747 Parents: 69ee4b8 Author: mick goulish Authored: Tue Oct 10 15:31:15 2017 -0400 Committer: mick goulish Committed: Tue Oct 10 15:31:15 2017 -0400 -- tests/system_tests_distribution.py | 907 1 file changed, 811 insertions(+), 96 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d9e328e5/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index d56e52d..8084344 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -27,6 +27,7 @@ from proton.utilsimport BlockingConnection from qpid_dispatch.management.client import Node import time +import datetime @@ -119,13 +120,102 @@ class DistributionTests ( TestCase ): super(DistributionTests, cls).setUpClass() +cls.linkroute_prefix = "0.0.0.0/linkroute" +cls.waypoint_prefix_1 = "0.0.0.0/queue_1" +cls.waypoint_prefix_2 = "0.0.0.0/queue_2" + +#- +# Here are some chunks of configuration that will be +# the same on all routers. +#- + +linkroute_configuration = \ +[ +( 'linkRoute', + { 'prefix': cls.linkroute_prefix, +'dir': 'in', +'containerId': 'LinkRouteTest' + } +), +( 'linkRoute', + { 'prefix': cls.linkroute_prefix, +'dir': 'out', +'containerId': 'LinkRouteTest' + } +) +] + + +waypoint_configuration_1 =\ +[ +( 'address', + { 'prefix': cls.waypoint_prefix_1, +'waypoint': 'yes' + } +), +( 'autoLink', + { 'addr': cls.waypoint_prefix_1 + '.waypoint', +'containerId': 'WaypointTest', +'dir': 'in' + } +), +( 'autoLink', + { 'addr': cls.waypoint_prefix_1 + '.waypoint', +'containerId': 'WaypointTest', +'dir': 'out' + } +) +] + +waypoint_configuration_2 = \ +[ +( 'address', + { 'prefix': cls.waypoint_prefix_2, +'ingressPhase' : 0,# into the waypoint-process +'egressPhase' : 2,# out of the waypoint process + } +), +( 'autoLink', + { 'addr': cls.waypoint_prefix_2 + '.waypoint', +'phase' : 0, +'containerId': 'WaypointTest2', +'dir': 'out'# out-of-router + } +), +( 'autoLink', + { 'addr': cls.waypoint_prefix_2 + '.waypoint', +'phase' : 1, +'containerId': 'WaypointTest2', +'dir': 'in'# into-router + } +), +( 'autoLink', + { 'addr': cls.waypoint_prefix_2 + '.waypoint', +'phase' : 1, # out-of-router +'containerId': 'WaypointTest2', +'dir': 'out' + } +), +( 'autoLink', + { 'addr': cls.waypoint_prefix_2 + '.waypoint', +'phase' : 2, # into-router +'containerId': 'WaypointTest2', +'dir': 'in' + } +) +] + def router(name, more_config): config = [ ('router', {'mode': 'interior', 'id': name}), ('address', {'prefix': 'closest', 'distribution': 'closest'}), ('address', {'prefix': 'balanced', 'distribution': 'balanced'}), ('address', {'prefix': 'multicast', 'distribution': 'multicast'}) - ] + more_config + ] \ + + linkroute_configuration \ + + waypoint_configuration_1 \ + + waypoint_configuration_2 \ +
qpid-dispatch git commit: DISPATCH-209 : linkroute 3-mesh failover test
Repository: qpid-dispatch Updated Branches: refs/heads/master 584a24cc7 -> 233f23f15 DISPATCH-209 : linkroute 3-mesh failover test Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/233f23f1 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/233f23f1 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/233f23f1 Branch: refs/heads/master Commit: 233f23f158e334ed14345892307773205b6395fb Parents: 584a24c Author: mick goulish Authored: Tue Sep 19 08:44:52 2017 -0400 Committer: mick goulish Committed: Tue Sep 19 08:44:52 2017 -0400 -- tests/system_tests_distribution.py | 156 1 file changed, 156 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/233f23f1/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index 2a30cde..d56e52d 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -1272,6 +1272,162 @@ class DistributionTests ( TestCase ): +def test_21_linkroute_mesh_failover ( self ) : +""" + c c +senders ---> A - B +\ / + \ / + \ / + \ / +\ / + D + c + +'c' indicates that I make connections to the route-container +listeners at the marked routers. +""" + +addr_suffix = "addr_21" + +# Choose which routers to give the test. +# This choice controls topology. ABD is triangular +# i.e. 3-mesh. +routers = ( self.A_route_container_addr, +self.B_route_container_addr, +self.D_route_container_addr + ) + +# NOTE : about these 3-tuples. +# The positions in these tuples correspond to the routers passed +# in to the test: ( router_1, router_2, router_3 ) +# router_1 is always the 'local' one -- the one where the +# test make its senders. + +# Tell the test on which routers to make its link-container cnxs. +where_to_make_connections = ( 2, 2, 2 ) +first_four= ( 4, 0, 0 ) +second_four = ( 4, 2, 2 ) +third_four= ( 4, 2, 6 ) + +# Tell the test how to check for the address being ready. +n_local_containers = 1 +n_remote_routers = 2 + + #--- +# This is the instruction-list that the test looks at as various +# milestones are met during testing. If a given event happens, +# and if it matches the event in the current step of the instructions, +# then the test will execute the action in the current step, and +# advance to the next. +# These instructions lists make the test more flexible, so I can get +# different behavior without writing *almost* the same code mutiple +# times. + #--- + +# note: if 'done' is present in an action, it always means 'succeed now'. +# If there had been a failure, that would have been caught in an +# earlier part of the action. + +instructions = [ + # Once the link-routable address is ready to use in + # the router network, create 4 senders. + { + 'event' : 'address_ready', + 'action' : { 'fn' : 'make_senders', + 'arg' : 4 + } + }, + # In this action, the list-argument to the function + # shows how we expect link-attach routes to be + # distributed: 4 to router B, + # none anywhere else. + { + 'event' : 'got_receivers', + 'action' : { 'fn' : 'check_receiver_distribution', +'arg' : first_four, + } + }, + # After we see that the first 4 senders have + # had their link-attaches routed to the right place, + # (which will be router A), close all route-container +
qpid-dispatch git commit: DISPATCH-209 : new 3-router pure linkroute tests
Repository: qpid-dispatch Updated Branches: refs/heads/master b0fcd9a54 -> 584a24cc7 DISPATCH-209 : new 3-router pure linkroute tests Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/584a24cc Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/584a24cc Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/584a24cc Branch: refs/heads/master Commit: 584a24cc74745e7f407fd5913ba3a0eec2b6b98c Parents: b0fcd9a Author: mick goulish Authored: Mon Sep 18 09:44:12 2017 -0400 Committer: mick goulish Committed: Mon Sep 18 09:44:12 2017 -0400 -- tests/system_tests_distribution.py | 1199 ++- 1 file changed, 1160 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/584a24cc/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index c244c54..2a30cde 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -22,13 +22,14 @@ from subprocess import PIPE, STDOUT from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process from proton.handlers import MessagingHandler -from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector from proton.utilsimport BlockingConnection from qpid_dispatch.management.client import Node import time + # PROTON-828: try: from proton import MODIFIED @@ -180,7 +181,7 @@ class DistributionTests ( TestCase ): cls.A_D_cost = 50 cls.B_D_cost = 100 -cls.linkroute_prefix = "0.0.0.0/linkroute" +cls.linkroute_prefix_1 = "0.0.0.0/linkroute_1" router ( 'A', [ @@ -201,19 +202,19 @@ class DistributionTests ( TestCase ): } ), ( 'listener', - { 'port': A_route_container_port, + { 'port': A_route_container_port, # route-container is number 3 'stripAnnotations': 'no', 'role': 'route-container' } ), ( 'linkRoute', - { 'prefix': cls.linkroute_prefix, + { 'prefix': cls.linkroute_prefix_1, 'dir': 'in', 'containerId': 'LinkRouteTest' } ), ( 'linkRoute', - { 'prefix': cls.linkroute_prefix, + { 'prefix': cls.linkroute_prefix_1, 'dir': 'out', 'containerId': 'LinkRouteTest' } @@ -240,19 +241,19 @@ class DistributionTests ( TestCase ): } ), ( 'listener', - { 'port': B_route_container_port, + { 'port': B_route_container_port, # route-container is number 3 'stripAnnotations': 'no', 'role': 'route-container' } ), ( 'linkRoute', - { 'prefix': cls.linkroute_prefix, + { 'prefix': cls.linkroute_prefix_1, 'dir': 'in', 'containerId': 'LinkRouteTest' } ), ( 'linkRoute', - { 'prefix': cls.linkroute_prefix, + { 'prefix': cls.linkroute_prefix_1, 'dir': 'out', 'containerId': 'LinkRouteTest' } @@ -277,19 +278,19 @@ class DistributionTests ( TestCase ): } ), ( 'listener', - { 'port': C_route_container_port, + { 'port': C_route_container_port, # route-container is number 1 'stripAnnotations': 'no', 'role': 'route-container' } ), ( 'linkRoute', - { 'prefix': cls.linkroute_prefix, + { 'prefix': cls.linkroute_prefix_1, 'dir': 'in', 'containerId': 'LinkRouteTest'
qpid-dispatch git commit: DISPATCH-209 : add multicast {linear, mesh} tests
Repository: qpid-dispatch Updated Branches: refs/heads/master b38e63edf -> 889644675 DISPATCH-209 : add multicast {linear,mesh} tests Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/88964467 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/88964467 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/88964467 Branch: refs/heads/master Commit: 8896446756dc158673c9222e8bdb13bf41bfbc97 Parents: b38e63e Author: mick goulish Authored: Fri Aug 18 16:39:19 2017 -0400 Committer: mick goulish Committed: Fri Aug 18 16:39:19 2017 -0400 -- tests/system_tests_distribution.py | 207 +++- 1 file changed, 203 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/88964467/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index 5cfc23d..c244c54 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -121,8 +121,9 @@ class DistributionTests ( TestCase ): def router(name, more_config): config = [ ('router', {'mode': 'interior', 'id': name}), - ('address', {'prefix': 'closest', 'distribution': 'closest'}), - ('address', {'prefix': 'balanced', 'distribution': 'balanced'}) + ('address', {'prefix': 'closest', 'distribution': 'closest'}), + ('address', {'prefix': 'balanced', 'distribution': 'balanced'}), + ('address', {'prefix': 'multicast', 'distribution': 'multicast'}) ] + more_config config = Qdrouterd.Config(config) @@ -422,7 +423,7 @@ class DistributionTests ( TestCase ): "addr_08" ) test.run() -self.assertEqual(None, test.error) +self.assertEqual ( None, test.error ) def test_09_closest_mesh ( self ): @@ -524,7 +525,7 @@ class DistributionTests ( TestCase ): omit_middle_receiver ) test.run() -self.assertEqual(None, test.error) +self.assertEqual ( None, test.error ) def test_11_balanced_linear_omit_middle_receiver ( self ): @@ -638,6 +639,26 @@ class DistributionTests ( TestCase ): self.assertEqual ( None, test.error ) +def test_13_multicast_linear ( self ): +test = MulticastTest ( self.A_addr, + self.B_addr, + self.C_addr, + "addr_13" + ) +test.run() +self.assertEqual ( None, test.error ) + + +def test_14_multicast_mesh ( self ): +test = MulticastTest ( self.A_addr, + self.B_addr, + self.D_addr, + "addr_14" + ) +test.run() +self.assertEqual ( None, test.error ) + + @@ -1406,5 +1427,183 @@ class BalancedTest ( MessagingHandler ): +class MulticastTest ( MessagingHandler ): +""" +Using multicast, we should see all receivers get everything, +whether the topology is linear or mesh. +""" +def __init__ ( self, router_1, router_2, router_3, addr_suffix ): +super ( MulticastTest, self ).__init__(prefetch=0) +self.error = None +self.router_1= router_1 +self.router_2= router_2 +self.router_3= router_3 +self.addr_suffix = addr_suffix +self.dest= "multicast/" + addr_suffix + +self.n_to_send = 100 +self.n_sent= 0 + +self.n_received = 0 + +self.count_1_a = 0 +self.count_1_b = 0 +self.count_2_a = 0 +self.count_2_b = 0 +self.count_3_a = 0 +self.count_3_b = 0 + +self.addr_check_timer= None +self.addr_check_receiver = None +self.addr_check_sender = None +self.sender = None +self.bailed = False + +def timeout ( self ): +self.check_results ( ) +self.bail ( "Timeout Expired " ) + + +def address_check_timeout(self): +self.addr_check() + + +def bail ( self, text ): +self.timer.cancel() +self.error = text +self.send_cnx.close() +self.cnx_1.close() +self.cnx_2.close() +self.cnx_3.close() +if self.addr_check_timer: +self.addr_check_timer.cancel() + + +def on_start ( self, event ): +self.timer= event.reactor.schedule ( TIMEOUT, Timeout
qpid-dispatch git commit: DISPATCH-209 : add closest_mesh test
Repository: qpid-dispatch Updated Branches: refs/heads/master 6def321f5 -> b38e63edf DISPATCH-209 : add closest_mesh test Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/b38e63ed Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/b38e63ed Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/b38e63ed Branch: refs/heads/master Commit: b38e63edff3f2ba820a9ed7574a40df10a0b8cc9 Parents: 6def321 Author: mick goulish Authored: Fri Aug 18 08:33:46 2017 -0400 Committer: mick goulish Committed: Fri Aug 18 08:33:46 2017 -0400 -- tests/system_tests_distribution.py | 248 1 file changed, 127 insertions(+), 121 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/b38e63ed/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index 1812b70..5cfc23d 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -368,26 +368,31 @@ class DistributionTests ( TestCase ): cls.C_addr = router_C.addresses[0] cls.D_addr = router_D.addresses[0] + def test_01_targeted_sender_AC ( self ): test = TargetedSenderTest ( self.A_addr, self.C_addr, "closest/01" ) test.run() self.assertEqual ( None, test.error ) + def test_02_targeted_sender_DC ( self ): test = TargetedSenderTest ( self.D_addr, self.C_addr, "closest/02" ) test.run() self.assertEqual ( None, test.error ) + def test_03_anonymous_sender_AC ( self ): test = AnonymousSenderTest ( self.A_addr, self.C_addr ) test.run() self.assertEqual ( None, test.error ) + def test_04_anonymous_sender_DC ( self ): test = AnonymousSenderTest ( self.D_addr, self.C_addr ) test.run() self.assertEqual ( None, test.error ) + def test_05_dynamic_reply_to_AC ( self ): test = DynamicReplyTo ( self.A_addr, self.C_addr ) test.run() @@ -407,7 +412,7 @@ class DistributionTests ( TestCase ): "addr_07" ) test.run() -self.assertEqual(None, test.error) +self.assertEqual ( None, test.error ) def test_08_closest ( self ): @@ -419,6 +424,16 @@ class DistributionTests ( TestCase ): test.run() self.assertEqual(None, test.error) + +def test_09_closest_mesh ( self ): +test = ClosestTest ( self.A_addr, + self.B_addr, + self.D_addr, + "addr_09" + ) +test.run() +self.assertEqual ( None, test.error ) + # # Cost picture for balanced distribution tests. # @@ -487,8 +502,7 @@ class DistributionTests ( TestCase ): # 100 55 33 12 # - -def test_09_balanced_linear ( self ): +def test_10_balanced_linear ( self ): # slop is how much the second two values may diverge from # the expected. But they still must sum to total - A. total = 100 @@ -497,10 +511,11 @@ class DistributionTests ( TestCase ): expected_C = 12 slop = 0 omit_middle_receiver = False + test = BalancedTest ( self.A_addr, self.B_addr, self.C_addr, - "addr_09", + "addr_10", total, expected_A, expected_B, @@ -512,7 +527,7 @@ class DistributionTests ( TestCase ): self.assertEqual(None, test.error) -def test_10_balanced_linear_omit_middle_receiver ( self ): +def test_11_balanced_linear_omit_middle_receiver ( self ): # If we omit the middle receiver, then router A will count # up to cost ( A, B ) and the keep counting up a further # cost ( B, C ) before it starts to spill over. @@ -529,10 +544,11 @@ class DistributionTests ( TestCase ): expected_C = 35 slop = 0 omit_middle_receiver = True + test = BalancedTest ( self.A_addr, self.B_addr, self.C_addr, - "addr_10", + "addr_11", total, expected_A, expected_B, @@ -541,7 +557,7 @@ class DistributionTests ( TestCase ): omit_middle_
qpid-dispatch git commit: DISPATCH-209 : uniq addresses used by tests
Repository: qpid-dispatch Updated Branches: refs/heads/master f146cfcd5 -> 835f14d0f DISPATCH-209 : uniq addresses used by tests Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/835f14d0 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/835f14d0 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/835f14d0 Branch: refs/heads/master Commit: 835f14d0f775063c45912e907f0d2a2d51c9feca Parents: f146cfc Author: mick goulish Authored: Thu Aug 17 07:32:35 2017 -0400 Committer: mick goulish Committed: Thu Aug 17 07:32:35 2017 -0400 -- tests/system_tests_distribution.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/835f14d0/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index 598c30b..1812b70 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -532,7 +532,7 @@ class DistributionTests ( TestCase ): test = BalancedTest ( self.A_addr, self.B_addr, self.C_addr, - "addr_09", + "addr_10", total, expected_A, expected_B, @@ -610,7 +610,7 @@ class DistributionTests ( TestCase ): test = BalancedTest ( self.A_addr, self.B_addr, self.D_addr, - "addr_10", + "addr_11", total, expected_A, expected_B, - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-dispatch git commit: DISPATCH-209 : add omit-middle-receiver test
Repository: qpid-dispatch Updated Branches: refs/heads/master e45842d43 -> e0cdeaaf5 DISPATCH-209 : add omit-middle-receiver test Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/e0cdeaaf Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/e0cdeaaf Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/e0cdeaaf Branch: refs/heads/master Commit: e0cdeaaf531fd0f03b187fb47df3f59c2d2fdb94 Parents: e45842d Author: mick goulish Authored: Tue Aug 15 13:24:53 2017 -0400 Committer: mick goulish Committed: Tue Aug 15 13:24:53 2017 -0400 -- tests/system_tests_distribution.py | 166 1 file changed, 107 insertions(+), 59 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e0cdeaaf/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py index 59924e0..598c30b 100644 --- a/tests/system_tests_distribution.py +++ b/tests/system_tests_distribution.py @@ -101,7 +101,7 @@ class AddressCheckerTimeout ( object ): # -# Setup +# Setup # class DistributionTests ( TestCase ): @@ -110,7 +110,7 @@ class DistributionTests ( TestCase ): def setUpClass(cls): """ Create a router topology that is a superset of the topologies we will -need for various tests. So far, we have only two types of tests: +need for various tests. So far, we have only two types of tests: 3-router linear, and 3-router triangular. The various tests simply attach their senders and receivers appropriately to 'see' their desired topology. @@ -133,18 +133,18 @@ class DistributionTests ( TestCase ): -# +# # Connection picture # -# 1 1 -# A < B <-- C -# ^ 2 ^ 2 -# \ / -#\ / -# \ / -# \ / -# D -# +# 1 1 +# A < B <-- C +# ^ 2 ^ 2 +# \ / +#\ / +# \ / +# \ / +# D +# # A_client_port = cls.tester.get_port() @@ -158,7 +158,7 @@ class DistributionTests ( TestCase ): B_inter_router_port_2 = cls.tester.get_port() # "Route-container port" does not mean that the port -# contains a route. It means that any client that +# contains a route. It means that any client that # connectsd to the port is considered to be a route- # container. A_route_container_port = cls.tester.get_port() @@ -171,7 +171,7 @@ class DistributionTests ( TestCase ): # Costs are associated not with routers, but with the # connections between routers. In the config, they may # be attached to the inter-router listener, or the connector, -# or both. If both the inter-router listener and the +# or both. If both the inter-router listener and the # connector have associated costs, the higher of the two # will be used. cls.A_B_cost = 10 @@ -217,11 +217,11 @@ class DistributionTests ( TestCase ): 'containerId': 'LinkRouteTest' } ) - ] + ] ) router ( 'B', - [ + [ ( 'listener', { 'port': B_client_port, 'role': 'normal', @@ -419,37 +419,37 @@ class DistributionTests ( TestCase ): test.run() self.assertEqual(None, test.error) -# +# # Cost picture for ba
qpid-dispatch git commit: DISPATCH-209 : change name and add new all-test topology
Repository: qpid-dispatch Updated Branches: refs/heads/master 098ec7d13 -> 9739f93e0 DISPATCH-209 : change name and add new all-test topology Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/9739f93e Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/9739f93e Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/9739f93e Branch: refs/heads/master Commit: 9739f93e0d94e3297def7a06b6e5ca2d67c9e6a3 Parents: 098ec7d Author: mick goulish Authored: Mon Aug 14 15:18:51 2017 -0400 Committer: mick goulish Committed: Mon Aug 14 15:18:51 2017 -0400 -- tests/CMakeLists.txt|2 +- tests/system_tests_distribution.py | 1356 ++ tests/system_tests_three_routers.py | 814 -- 3 files changed, 1357 insertions(+), 815 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9739f93e/tests/CMakeLists.txt -- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8108434..fc9d548 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -92,7 +92,7 @@ foreach(py_test_module system_tests_user_id_proxy system_tests_deprecated system_tests_two_routers -system_tests_three_routers +system_tests_distribution system_tests_multi_tenancy system_tests_dynamic_terminus system_tests_log_message_components http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9739f93e/tests/system_tests_distribution.py -- diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py new file mode 100644 index 000..59924e0 --- /dev/null +++ b/tests/system_tests_distribution.py @@ -0,0 +1,1356 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +import unittest, os, json +from subprocess import PIPE, STDOUT +from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout +from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process +from proton.handlers import MessagingHandler +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption +from proton.utilsimport BlockingConnection +from qpid_dispatch.management.client import Node + +import time + + +# PROTON-828: +try: +from proton import MODIFIED +except ImportError: +from proton import PN_STATUS_MODIFIED as MODIFIED + + + + +# +# Helper classes for all tests. +# + +class Timeout(object): +def __init__(self, parent): +self.parent = parent + +def on_timer_task(self, event): +self.parent.timeout() + + + +class AddressCheckResponse(object): +""" +Convenience class for the responses returned by an AddressChecker. +""" +def __init__(self, status_code, status_description, attrs): +self.status_code= status_code +self.status_description = status_description +self.attrs = attrs + +def __getattr__(self, key): +return self.attrs[key] + + + +class AddressChecker ( object ): +""" +Format address-query messages and parse the responses. +""" +def __init__ ( self, reply_addr ): +self.reply_addr = reply_addr + +def parse_address_query_response ( self, msg ): +ap = msg.properties +return AddressCheckResponse ( ap['statusCode'], ap['statusDescription'], msg.body ) + +def make_address_query ( self, name ): +ap = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.router.address', 'name': name} +return Message ( properties=ap, reply_to=self.reply_addr ) + +def make_addresses_query ( self ): +ap = {'operation': 'QUERY', 'type': 'org.apache.qpid.dispatch.router.address'} +return Message ( properties=ap, reply_to=self.reply_addr ) + +
qpid-dispatch git commit: DISPATCH-209 -- linkroute test based on multi tenancy
Repository: qpid-dispatch Updated Branches: refs/heads/master 93972821f -> 1f1089b10 DISPATCH-209 -- linkroute test based on multi tenancy (cherry picked from commit 63b2b52c739d3fb9e090861a68b568b6d09262fb) Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/1f1089b1 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/1f1089b1 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/1f1089b1 Branch: refs/heads/master Commit: 1f1089b1052080645160fd3701004d386e4432b1 Parents: 9397282 Author: mick goulish Authored: Mon Jul 10 13:39:39 2017 -0400 Committer: mick goulish Committed: Mon Jul 10 13:43:32 2017 -0400 -- tests/system_tests_three_routers.py | 437 --- 1 file changed, 344 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1f1089b1/tests/system_tests_three_routers.py -- diff --git a/tests/system_tests_three_routers.py b/tests/system_tests_three_routers.py index cfc210c..289cc02 100644 --- a/tests/system_tests_three_routers.py +++ b/tests/system_tests_three_routers.py @@ -18,11 +18,14 @@ # import unittest, os, json -from subprocess import PIPE, STDOUT -from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout -from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process +from subprocess import PIPE, STDOUT +from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout +from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process from proton.handlers import MessagingHandler -from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption +from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption +from proton.utilsimport BlockingConnection +from qpid_dispatch.management.client import Node + import time @@ -42,126 +45,178 @@ class RouterTest(TestCase): """Start a router and a sender-listener client""" super(RouterTest, cls).setUpClass() -def router ( name, connection_1, connection_2=None ): - -config = [ -('router', - {'mode' : 'interior', - 'id' : 'QDR.%s' % name - } -), -('listener', - {'port' : cls.tester.get_port(), - 'stripAnnotations' : 'no' - } -), -('address', -{ 'prefix' : 'closest', - 'distribution' : 'closest' -} -), -] -config.append ( connection_1 ) -if None != connection_2: -config.append ( connection_2 ) - -config = Qdrouterd.Config ( config ) - -cls.routers.append ( cls.tester.qdrouterd(name, config, wait=True) ) +def router(name, more_config): + + +config = [ ('router', {'mode': 'interior', 'id': name}) ] + more_config + +config = Qdrouterd.Config(config) + +cls.routers.append(cls.tester.qdrouterd(name, config, wait=True)) cls.routers = [] -inter_router_port_A = cls.tester.get_port() inter_router_port_B = cls.tester.get_port() -port_for_sender = cls.tester.get_port() +A_normal_port = cls.tester.get_port() +A_route_container_port = cls.tester.get_port() +A_inter_router_port= cls.tester.get_port() + +cls.linkroute_prefix = "0.0.0.0/link" router ( 'A', + [ +( 'listener', + { 'port': A_normal_port, +'stripAnnotations': 'no' + } +), +( 'listener', + { 'port': A_route_container_port, +'stripAnnotations': 'no', +'role': 'route-container' + } +), ( 'listener', - {'role': 'inter-router', -'port': inter_router_port_A - } + { 'role': 'inter-router', +'port': A_inter_router_port, + } + ), + ( 'linkRoute', + { 'prefix': cls.linkroute_prefix, + 'dir': 'in', + 'containerId': 'LinkRouteTest' + } + ), + ( 'linkRou
qpid-proton git commit: PROTON-919: make C behave same as Java wrt channel_max error
Repository: qpid-proton Updated Branches: refs/heads/master 17250c947 -> 4ee726002 PROTON-919: make C behave same as Java wrt channel_max error Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/4ee72600 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/4ee72600 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/4ee72600 Branch: refs/heads/master Commit: 4ee726002804d7286a8c76b42e0a0717e0798822 Parents: 17250c9 Author: mgoulish Authored: Fri Jul 17 10:29:13 2015 -0400 Committer: mgoulish Committed: Fri Jul 17 10:29:13 2015 -0400 -- proton-c/bindings/python/proton/__init__.py | 3 ++- proton-c/include/proton/error.h | 1 + proton-c/include/proton/transport.h | 3 ++- proton-c/src/transport/transport.c | 16 +--- tests/python/proton_tests/engine.py | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4ee72600/proton-c/bindings/python/proton/__init__.py -- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index d5dcceb..46b9466 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -3352,7 +3352,8 @@ Sets the maximum size for received frames (in bytes). return pn_transport_get_channel_max(self._impl) def _set_channel_max(self, value): -pn_transport_set_channel_max(self._impl, value) +if pn_transport_set_channel_max(self._impl, value): + raise SessionException("Too late to change channel max.") channel_max = property(_get_channel_max, _set_channel_max, doc=""" http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4ee72600/proton-c/include/proton/error.h -- diff --git a/proton-c/include/proton/error.h b/proton-c/include/proton/error.h index 2ed2f31..5945af8 100644 --- a/proton-c/include/proton/error.h +++ b/proton-c/include/proton/error.h @@ -31,6 +31,7 @@ extern "C" { typedef struct pn_error_t pn_error_t; +#define PN_OK (0) #define PN_EOS (-1) #define PN_ERR (-2) #define PN_OVERFLOW (-3) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4ee72600/proton-c/include/proton/transport.h -- diff --git a/proton-c/include/proton/transport.h b/proton-c/include/proton/transport.h index 483f5a9..cfa6d71 100644 --- a/proton-c/include/proton/transport.h +++ b/proton-c/include/proton/transport.h @@ -345,8 +345,9 @@ PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport); * * @param[in] transport a transport object * @param[in] channel_max the maximum allowed channel + * @return PN_OK, or PN_STATE_ERR if it is too late to change channel_max */ -PN_EXTERN void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max); +PN_EXTERN int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max); /** * Get the maximum allowed channel of a transport's remote peer. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4ee72600/proton-c/src/transport/transport.c -- diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c index 7bce3b5..6abf862 100644 --- a/proton-c/src/transport/transport.c +++ b/proton-c/src/transport/transport.c @@ -2677,7 +2677,7 @@ uint16_t pn_transport_get_channel_max(pn_transport_t *transport) return transport->channel_max; } -void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t requested_channel_max) +int pn_transport_set_channel_max(pn_transport_t *transport, uint16_t requested_channel_max) { /* * Once the OPEN frame has been sent, we have communicated our @@ -2691,13 +2691,15 @@ void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t requested_ */ if(transport->open_sent) { pn_transport_logf(transport, "Cannot change local channel-max after OPEN frame sent."); +return PN_STATE_ERR; } - else { -transport->local_channel_max = (requested_channel_max < PN_IMPL_CHANNEL_MAX) - ? requested_channel_max - : PN_IMPL_CHANNEL_MAX; -pni_calculate_channel_max(transport); - } + + transport->local_channel_max = (requested_channel_max < PN_IMPL_CHANNEL_MAX) + ? requested_channel_max + : PN_IMPL_CHANNEL_MAX; +
qpid-proton git commit: PROTON-925: use of UINT32_MAX is breaking some builds. Getting better constants will be part of PROTON-930
Repository: qpid-proton Updated Branches: refs/heads/master 940d843f3 -> 3c14a0d1c PROTON-925: use of UINT32_MAX is breaking some builds. Getting better constants will be part of PROTON-930 Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3c14a0d1 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3c14a0d1 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3c14a0d1 Branch: refs/heads/master Commit: 3c14a0d1cf89b988529b98dc10c8f2c17abcdcf3 Parents: 940d843 Author: mgoulish Authored: Mon Jul 6 11:37:00 2015 -0400 Committer: mgoulish Committed: Mon Jul 6 11:41:18 2015 -0400 -- proton-c/src/transport/transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3c14a0d1/proton-c/src/transport/transport.c -- diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c index 36eeb00..e5e8276 100644 --- a/proton-c/src/transport/transport.c +++ b/proton-c/src/transport/transport.c @@ -396,7 +396,7 @@ static void pn_transport_initialize(void *object) transport->remote_container = NULL; transport->remote_hostname = NULL; transport->local_max_frame = PN_DEFAULT_MAX_FRAME_SIZE; - transport->remote_max_frame = UINT32_MAX; + transport->remote_max_frame = (uint32_t) 0x; /* * We set the local limit on channels to 2^15, because - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton git commit: PROTON-925: use scanner right for remote_channel_max and remote_max_frame
Repository: qpid-proton Updated Branches: refs/heads/master 7e3190306 -> fc38e86a6 PROTON-925: use scanner right for remote_channel_max and remote_max_frame Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/fc38e86a Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/fc38e86a Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/fc38e86a Branch: refs/heads/master Commit: fc38e86a6f5a1b265552708e674d3c8040c1985b Parents: 7e31903 Author: mgoulish Authored: Thu Jul 2 16:43:45 2015 -0400 Committer: mgoulish Committed: Thu Jul 2 16:43:45 2015 -0400 -- proton-c/src/transport/transport.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fc38e86a/proton-c/src/transport/transport.c -- diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c index a4b07c3..36eeb00 100644 --- a/proton-c/src/transport/transport.c +++ b/proton-c/src/transport/transport.c @@ -396,7 +396,7 @@ static void pn_transport_initialize(void *object) transport->remote_container = NULL; transport->remote_hostname = NULL; transport->local_max_frame = PN_DEFAULT_MAX_FRAME_SIZE; - transport->remote_max_frame = 0; + transport->remote_max_frame = UINT32_MAX; /* * We set the local limit on channels to 2^15, because @@ -1101,20 +1101,37 @@ static char *pn_bytes_strdup(pn_bytes_t str) int pn_do_open(pn_transport_t *transport, uint8_t frame_type, uint16_t channel, pn_data_t *args, const pn_bytes_t *payload) { pn_connection_t *conn = transport->connection; - bool container_q, hostname_q; + bool container_q, hostname_q, remote_channel_max_q, remote_max_frame_q; + uint16_t remote_channel_max; + uint32_t remote_max_frame; pn_bytes_t remote_container, remote_hostname; pn_data_clear(transport->remote_offered_capabilities); pn_data_clear(transport->remote_desired_capabilities); pn_data_clear(transport->remote_properties); - int err = pn_data_scan(args, "D.[?S?SIHI..CCC]", &container_q, - &remote_container, &hostname_q, &remote_hostname, - &transport->remote_max_frame, - &transport->remote_channel_max, + int err = pn_data_scan(args, "D.[?S?S?I?HI..CCC]", + &container_q, &remote_container, + &hostname_q, &remote_hostname, + &remote_max_frame_q, &remote_max_frame, + &remote_channel_max_q, &remote_channel_max, &transport->remote_idle_timeout, transport->remote_offered_capabilities, transport->remote_desired_capabilities, transport->remote_properties); if (err) return err; + /* + * The default value is already stored in the variable. + * But the scanner zeroes out values if it does not + * find them in the args, so don't give the variable + * directly to the scanner. + */ + if (remote_channel_max_q) { +transport->remote_channel_max = remote_channel_max; + } + + if (remote_max_frame_q) { +transport->remote_max_frame = remote_max_frame; + } + if (transport->remote_max_frame > 0) { if (transport->remote_max_frame < AMQP_MIN_MAX_FRAME_SIZE) { pn_transport_logf(transport, "Peer advertised bad max-frame (%u), forcing to %u", - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton git commit: PROTON-925: old line of code was initializing remote_channel_max to zero.
Repository: qpid-proton Updated Branches: refs/heads/master 2c383aaa8 -> c78392f19 PROTON-925: old line of code was initializing remote_channel_max to zero. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c78392f1 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c78392f1 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c78392f1 Branch: refs/heads/master Commit: c78392f1901a9a4fa2a44005f78a085840b160b3 Parents: 2c383aa Author: mgoulish Authored: Wed Jul 1 02:15:16 2015 -0400 Committer: mgoulish Committed: Wed Jul 1 02:15:16 2015 -0400 -- proton-c/src/transport/transport.c | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c78392f1/proton-c/src/transport/transport.c -- diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c index 4cf935b..2271f27 100644 --- a/proton-c/src/transport/transport.c +++ b/proton-c/src/transport/transport.c @@ -414,7 +414,6 @@ static void pn_transport_initialize(void *object) transport->local_channel_max = PN_IMPL_CHANNEL_MAX; transport->channel_max= transport->local_channel_max; - transport->remote_channel_max = 0; transport->local_idle_timeout = 0; transport->dead_remote_deadline = 0; transport->last_bytes_input = 0; - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton git commit: PROTON-842: fix java tests that I broke with previous commit.
Repository: qpid-proton Updated Branches: refs/heads/master 17594bc3f -> ee43cbb7e PROTON-842: fix java tests that I broke with previous commit. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ee43cbb7 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ee43cbb7 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ee43cbb7 Branch: refs/heads/master Commit: ee43cbb7ed5762e45b690631ad7e90d9f6031ca6 Parents: 17594bc Author: Mick Goulish Authored: Tue Jun 23 11:36:21 2015 -0400 Committer: Mick Goulish Committed: Tue Jun 23 11:36:21 2015 -0400 -- .../qpid/proton/engine/impl/TransportImpl.java | 19 +-- tests/python/proton_tests/engine.py | 35 ++-- 2 files changed, 40 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ee43cbb7/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java -- diff --git a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java index a5c8ba9..835d214 100644 --- a/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java +++ b/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java @@ -63,6 +63,7 @@ public class TransportImpl extends EndpointImpl FrameHandler, TransportOutputWriter { static final int BUFFER_RELEASE_THRESHOLD = Integer.getInteger("proton.transport_buffer_release_threshold", 2 * 1024 * 1024); +private static final int CHANNEL_MAX_LIMIT = 65535; private static final boolean getBooleanEnv(String name) { @@ -97,8 +98,8 @@ public class TransportImpl extends EndpointImpl private int _maxFrameSize = DEFAULT_MAX_FRAME_SIZE; private int _remoteMaxFrameSize = 512; -private int _channelMax = 65535; -private int _remoteChannelMax = 65535; +private int _channelMax = CHANNEL_MAX_LIMIT; +private int _remoteChannelMax = CHANNEL_MAX_LIMIT; private final FrameWriter _frameWriter; @@ -204,7 +205,19 @@ public class TransportImpl extends EndpointImpl @Override public void setChannelMax(int n) { -_channelMax = n; +if(_isOpenSent) +{ + throw new IllegalArgumentException("Cannot change channel max after open frame has been sent"); +} + +if(n < CHANNEL_MAX_LIMIT) +{ +_channelMax = n; +} +else +{ +_channelMax = CHANNEL_MAX_LIMIT; +} } @Override http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ee43cbb7/tests/python/proton_tests/engine.py -- diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py index 8021e64..258665d 100644 --- a/tests/python/proton_tests/engine.py +++ b/tests/python/proton_tests/engine.py @@ -236,29 +236,42 @@ class ConnectionTest(Test): self.pump() assert self.c1.transport.channel_max == value, (self.c1.transport.channel_max, value) - def test_channel_max_high(self, value=3): -if "java" in sys.platform: - raise Skipped("Mick needs to fix me") + def test_channel_max_high(self, value=65535): self.c1.transport.channel_max = value self.c1.open() self.pump() -assert self.c1.transport.channel_max == 32767, (self.c1.transport.channel_max, value) +if "java" in sys.platform: + assert self.c1.transport.channel_max == 65535, (self.c1.transport.channel_max, value) +else: + assert self.c1.transport.channel_max == 32767, (self.c1.transport.channel_max, value) def test_channel_max_raise_and_lower(self): if "java" in sys.platform: - raise Skipped("Mick needs to fix me, also") -# It's OK to lower the max below 32767. + upper_limit = 65535 +else: + upper_limit = 32767 + +# It's OK to lower the max below upper_limit. self.c1.transport.channel_max = 12345 assert self.c1.transport.channel_max == 12345 -# But it won't let us raise the limit above 32767. -self.c1.transport.channel_max = 3 -assert self.c1.transport.channel_max == 32767 + +# But it won't let us raise the limit above PN_IMPL_CHANNEL_MAX. +self.c1.transport.channel_max = 65535 +assert self.c1.transport.channel_max == upper_limit + +# send the OPEN frame self.c1.open() self.pump() + # Now it's too late to make any change, because # we have already sent the OPEN frame. -self.c1.transport.channel_max = 666 -assert self.c1.transport.channel_max == 32767 +try: + self.c1.transport.channel_max = 6
qpid-proton git commit: PROTON-842: enforce channel_max limit on session creation
Repository: qpid-proton Updated Branches: refs/heads/master 175a15a87 -> e38957ae5 PROTON-842: enforce channel_max limit on session creation Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e38957ae Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e38957ae Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e38957ae Branch: refs/heads/master Commit: e38957ae5115ec023993672ca5b7d5e3df414f7e Parents: 175a15a Author: Mick Goulish Authored: Thu Jun 18 08:45:47 2015 -0400 Committer: Mick Goulish Committed: Thu Jun 18 08:45:47 2015 -0400 -- proton-c/bindings/python/proton/__init__.py | 7 +- proton-c/include/proton/cproton.i | 2 - proton-c/include/proton/transport.h | 16 +++- proton-c/src/engine/engine-internal.h | 14 ++- proton-c/src/engine/engine.c| 16 +++- proton-c/src/transport/transport.c | 111 --- tests/python/proton_tests/engine.py | 44 - 7 files changed, 191 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/bindings/python/proton/__init__.py -- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index 9432bd8..5860764 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -2484,7 +2484,11 @@ class Connection(Wrapper, Endpoint): """ Returns a new session on this connection. """ -return Session(pn_session(self._impl)) +ssn = pn_session(self._impl) +if ssn is None: + raise(SessionException("Session allocation failed.")) +else: + return Session(ssn) def session_head(self, mask): return Session.wrap(pn_session_head(self._impl, mask)) @@ -3987,6 +3991,7 @@ __all__ = [ "SASL", "Sender", "Session", + "SessionException", "SSL", "SSLDomain", "SSLSessionDetails", http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/include/proton/cproton.i -- diff --git a/proton-c/include/proton/cproton.i b/proton-c/include/proton/cproton.i index ac2b121..b55211f 100644 --- a/proton-c/include/proton/cproton.i +++ b/proton-c/include/proton/cproton.i @@ -210,8 +210,6 @@ typedef unsigned long int uintptr_t; { require: connection != NULL; - ensure: - pn_session != NULL; } %contract pn_transport(pn_connection_t *connection) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/include/proton/transport.h -- diff --git a/proton-c/include/proton/transport.h b/proton-c/include/proton/transport.h index a3ca667..483f5a9 100644 --- a/proton-c/include/proton/transport.h +++ b/proton-c/include/proton/transport.h @@ -320,6 +320,10 @@ PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ... /** * Get the maximum allowed channel for a transport. + * This will be the minimum of + * 1. limit imposed by this proton implementation + * 2. limit imposed by remote peer + * 3. limit imposed by this application, using pn_transport_set_channel_max() * * @param[in] transport a transport object * @return the maximum allowed channel @@ -327,7 +331,17 @@ PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ... PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport); /** - * Set the maximum allowed channel for a transport. + * Set the maximum allowed channel number for a transport. + * Note that this is the maximum channel number allowed, giving a + * valid channel number range of [0..channel_max]. Therefore the + * maximum number of simultaineously active channels will be + * channel_max plus 1. + * You can call this function more than once to raise and lower + * the limit your application imposes on max channels for this + * transport. However, smaller limits may be imposed by this + * library, or by the remote peer. + * After the OPEN frame has been sent to the remote peer, + * further calls to this function will have no effect. * * @param[in] transport a transport object * @param[in] channel_max the maximum allowed channel http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e38957ae/proton-c/src/engine/engine-internal.h -- diff --git a/proton-c/src/engine/engine-internal.h b/proton-c/src/engine/engine-internal.h index 4c72310..c03a0a3 100644 --- a/proton-c/src/engine/engine-internal.h +++ b/pr
[2/2] qpid-proton git commit: PROTON-896: declare functions static that are only referred to in one file, and change their names to have pni_ prefix.
PROTON-896: declare functions static that are only referred to in one file, and change their names to have pni_ prefix. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d921c6bc Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d921c6bc Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d921c6bc Branch: refs/heads/master Commit: d921c6bc8a05663daa2bc0ff38e6d8808b029802 Parents: 5a6c8da Author: Mick Goulish Authored: Mon Jun 8 10:05:50 2015 -0400 Committer: Mick Goulish Committed: Mon Jun 8 10:05:50 2015 -0400 -- proton-c/src/buffer.c | 56 - proton-c/src/codec/codec.c| 190 ++--- proton-c/src/codec/decoder.c | 28 ++--- proton-c/src/engine/engine-internal.h | 2 - proton-c/src/engine/engine.c | 124 ++- proton-c/src/object/list.c| 11 +- proton-c/src/object/map.c | 4 +- proton-c/src/parser.c | 119 +- proton-c/src/scanner.c| 90 +++--- proton-c/src/transport/transport.c| 174 +- 10 files changed, 390 insertions(+), 408 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/buffer.c -- diff --git a/proton-c/src/buffer.c b/proton-c/src/buffer.c index 145292a..64fa61f 100644 --- a/proton-c/src/buffer.c +++ b/proton-c/src/buffer.c @@ -81,12 +81,12 @@ size_t pn_buffer_available(pn_buffer_t *buf) return buf->capacity - buf->size; } -size_t pn_buffer_head(pn_buffer_t *buf) +static size_t pni_buffer_head(pn_buffer_t *buf) { return buf->start; } -size_t pn_buffer_tail(pn_buffer_t *buf) +static size_t pni_buffer_tail(pn_buffer_t *buf) { size_t tail = buf->start + buf->size; if (tail >= buf->capacity) @@ -94,42 +94,42 @@ size_t pn_buffer_tail(pn_buffer_t *buf) return tail; } -bool pn_buffer_wrapped(pn_buffer_t *buf) +static bool pni_buffer_wrapped(pn_buffer_t *buf) { - return buf->size && pn_buffer_head(buf) >= pn_buffer_tail(buf); + return buf->size && pni_buffer_head(buf) >= pni_buffer_tail(buf); } -size_t pn_buffer_tail_space(pn_buffer_t *buf) +static size_t pni_buffer_tail_space(pn_buffer_t *buf) { - if (pn_buffer_wrapped(buf)) { + if (pni_buffer_wrapped(buf)) { return pn_buffer_available(buf); } else { -return buf->capacity - pn_buffer_tail(buf); +return buf->capacity - pni_buffer_tail(buf); } } -size_t pn_buffer_head_space(pn_buffer_t *buf) +static size_t pni_buffer_head_space(pn_buffer_t *buf) { - if (pn_buffer_wrapped(buf)) { + if (pni_buffer_wrapped(buf)) { return pn_buffer_available(buf); } else { -return pn_buffer_head(buf); +return pni_buffer_head(buf); } } -size_t pn_buffer_head_size(pn_buffer_t *buf) +static size_t pni_buffer_head_size(pn_buffer_t *buf) { - if (pn_buffer_wrapped(buf)) { -return buf->capacity - pn_buffer_head(buf); + if (pni_buffer_wrapped(buf)) { +return buf->capacity - pni_buffer_head(buf); } else { -return pn_buffer_tail(buf) - pn_buffer_head(buf); +return pni_buffer_tail(buf) - pni_buffer_head(buf); } } -size_t pn_buffer_tail_size(pn_buffer_t *buf) +static size_t pni_buffer_tail_size(pn_buffer_t *buf) { - if (pn_buffer_wrapped(buf)) { -return pn_buffer_tail(buf); + if (pni_buffer_wrapped(buf)) { +return pni_buffer_tail(buf); } else { return 0; } @@ -138,8 +138,8 @@ size_t pn_buffer_tail_size(pn_buffer_t *buf) int pn_buffer_ensure(pn_buffer_t *buf, size_t size) { size_t old_capacity = buf->capacity; - size_t old_head = pn_buffer_head(buf); - bool wrapped = pn_buffer_wrapped(buf); + size_t old_head = pni_buffer_head(buf); + bool wrapped = pni_buffer_wrapped(buf); while (pn_buffer_available(buf) < size) { buf->capacity = 2*(buf->capacity ? buf->capacity : 16); @@ -166,8 +166,8 @@ int pn_buffer_append(pn_buffer_t *buf, const char *bytes, size_t size) int err = pn_buffer_ensure(buf, size); if (err) return err; - size_t tail = pn_buffer_tail(buf); - size_t tail_space = pn_buffer_tail_space(buf); + size_t tail = pni_buffer_tail(buf); + size_t tail_space = pni_buffer_tail_space(buf); size_t n = pn_min(tail_space, size); memmove(buf->bytes + tail, bytes, n); @@ -183,8 +183,8 @@ int pn_buffer_prepend(pn_buffer_t *buf, const char *bytes, size_t size) int err = pn_buffer_ensure(buf, size); if (err) return err; - size_t head = pn_buffer_head(buf); - size_t head_space = pn_buffer_head_space(buf); + size_t head = pni_buffer_head(buf); + size_t head_space = pni_buffer_head_space(buf); size_t n = pn_min(head_space, size); memmove(buf->bytes + head - n, b
[1/2] qpid-proton git commit: PROTON-896: declare functions static that are only referred to in one file, and change their names to have pni_ prefix.
Repository: qpid-proton Updated Branches: refs/heads/master 5a6c8da65 -> d921c6bc8 http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d921c6bc/proton-c/src/transport/transport.c -- diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c index e72875b..b5887ef 100644 --- a/proton-c/src/transport/transport.c +++ b/proton-c/src/transport/transport.c @@ -54,7 +54,7 @@ void pn_delivery_map_free(pn_delivery_map_t *db) pn_free(db->deliveries); } -pn_delivery_t *pn_delivery_map_get(pn_delivery_map_t *db, pn_sequence_t id) +static pn_delivery_t *pni_delivery_map_get(pn_delivery_map_t *db, pn_sequence_t id) { return (pn_delivery_t *) pn_hash_get(db->deliveries, id); } @@ -66,7 +66,7 @@ static void pn_delivery_state_init(pn_delivery_state_t *ds, pn_delivery_t *deliv ds->init = true; } -pn_delivery_state_t *pn_delivery_map_push(pn_delivery_map_t *db, pn_delivery_t *delivery) +static pn_delivery_state_t *pni_delivery_map_push(pn_delivery_map_t *db, pn_delivery_t *delivery) { pn_delivery_state_t *ds = &delivery->state; pn_delivery_state_init(ds, delivery, db->next++); @@ -83,7 +83,7 @@ void pn_delivery_map_del(pn_delivery_map_t *db, pn_delivery_t *delivery) } } -void pn_delivery_map_clear(pn_delivery_map_t *dm) +static void pni_delivery_map_clear(pn_delivery_map_t *dm) { pn_hash_t *hash = dm->deliveries; for (pn_handle_t entry = pn_hash_head(hash); @@ -405,7 +405,7 @@ static void pn_transport_initialize(void *object) } -pn_session_t *pn_channel_state(pn_transport_t *transport, uint16_t channel) +static pn_session_t *pni_channel_state(pn_transport_t *transport, uint16_t channel) { return (pn_session_t *) pn_hash_get(transport->remote_channels, channel); } @@ -423,7 +423,7 @@ void pni_transport_unbind_handles(pn_hash_t *handles, bool reset_state); static void pni_unmap_remote_channel(pn_session_t *ssn) { // XXX: should really update link state also - pn_delivery_map_clear(&ssn->state.incoming); + pni_delivery_map_clear(&ssn->state.incoming); pni_transport_unbind_handles(ssn->state.remote_handles, false); pn_transport_t *transport = ssn->connection->transport; uint16_t channel = ssn->state.remote_channel; @@ -637,8 +637,8 @@ void pni_transport_unbind_channels(pn_hash_t *channels) for (pn_handle_t h = pn_hash_head(channels); h; h = pn_hash_next(channels, h)) { uintptr_t key = pn_hash_key(channels, h); pn_session_t *ssn = (pn_session_t *) pn_hash_value(channels, h); -pn_delivery_map_clear(&ssn->state.incoming); -pn_delivery_map_clear(&ssn->state.outgoing); +pni_delivery_map_clear(&ssn->state.incoming); +pni_delivery_map_clear(&ssn->state.outgoing); pni_transport_unbind_handles(ssn->state.local_handles, true); pni_transport_unbind_handles(ssn->state.remote_handles, true); pn_session_unbound(ssn); @@ -662,8 +662,8 @@ int pn_transport_unbind(pn_transport_t *transport) // XXX: what happens if the endpoints are freed before we get here? pn_session_t *ssn = pn_session_head(conn, 0); while (ssn) { -pn_delivery_map_clear(&ssn->state.incoming); -pn_delivery_map_clear(&ssn->state.outgoing); +pni_delivery_map_clear(&ssn->state.incoming); +pni_delivery_map_clear(&ssn->state.outgoing); ssn = pn_session_next(ssn, 0); } @@ -721,7 +721,7 @@ static void pni_unmap_remote_handle(pn_link_t *link) pn_hash_del(link->session->state.remote_handles, handle); } -pn_link_t *pn_handle_state(pn_session_t *ssn, uint32_t handle) +static pn_link_t *pni_handle_state(pn_session_t *ssn, uint32_t handle) { return (pn_link_t *) pn_hash_get(ssn->state.remote_handles, handle); } @@ -849,17 +849,17 @@ int pn_post_frame(pn_transport_t *transport, uint8_t type, uint16_t ch, const ch return 0; } -int pn_post_amqp_transfer_frame(pn_transport_t *transport, uint16_t ch, -uint32_t handle, -pn_sequence_t id, -pn_bytes_t *payload, -const pn_bytes_t *tag, -uint32_t message_format, -bool settled, -bool more, -pn_sequence_t frame_limit, -uint64_t code, -pn_data_t* state) +static int pni_post_amqp_transfer_frame(pn_transport_t *transport, uint16_t ch, +uint32_t handle, +pn_sequence_t id, +pn_bytes_t *payload, +const pn_bytes_t *tag, +uint32_t message_format, +bool settled, +bool more, +
svn commit: r1657604 - /qpid/dispatch/trunk/src/server.c
Author: mgoulish Date: Thu Feb 5 15:32:28 2015 New Revision: 1657604 URL: http://svn.apache.org/r1657604 Log: DISPATCH-106 : pn link corruption after router restart Events must be processed one more time on a dead connector, because those events are what makes the stale links gets cleaned up. Modified: qpid/dispatch/trunk/src/server.c Modified: qpid/dispatch/trunk/src/server.c URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/server.c?rev=1657604&r1=1657603&r2=1657604&view=diff == --- qpid/dispatch/trunk/src/server.c (original) +++ qpid/dispatch/trunk/src/server.c Thu Feb 5 15:32:28 2015 @@ -574,8 +574,12 @@ static void *thread_run(void *arg) if (qdpn_connector_failed(cxtr)) qdpn_connector_close(cxtr); -else -work_done = process_connector(qd_server, cxtr); + +// +// Even if the connector has failed there are still events that +// must be processed so that associated links will be cleaned up. +// +work_done = process_connector(qd_server, cxtr); // // Check to see if the connector was closed during processing - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
qpid-proton git commit: initial commit of psend/precv examples.
Repository: qpid-proton Updated Branches: refs/heads/master 4d2a6fd01 -> cefbf9839 initial commit of psend/precv examples. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cefbf983 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cefbf983 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cefbf983 Branch: refs/heads/master Commit: cefbf9839e9c9f966f3b425da16ad26fc31b45fc Parents: 4d2a6fd Author: mick Authored: Mon Dec 8 12:00:53 2014 -0500 Committer: mick Committed: Mon Dec 8 12:00:53 2014 -0500 -- examples/engine/c/precv.c | 502 + examples/engine/c/psend.c | 373 ++ 2 files changed, 875 insertions(+) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cefbf983/examples/engine/c/precv.c -- diff --git a/examples/engine/c/precv.c b/examples/engine/c/precv.c new file mode 100644 index 000..3c79a6e --- /dev/null +++ b/examples/engine/c/precv.c @@ -0,0 +1,502 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + + +/* + This program is half of a pair. Precv and Psend are meant to + be simple-as-possible examples of how to use the proton-c + engine interface to send and receive messages over a single + connection and a single session. + + In addition to being examples, these programs or their + descendants will be used in performance regression testing + for both throughput and latency, and long-term soak testing. +**/ + +#include +#include +#include +#include +#include +#include +#include +#define __STDC_FORMAT_MACROS +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + + + + +#define MY_BUF_SIZE 1000 + + + + +/*- + These high-resolution times are used both for + interim timing reports -- i.e. every 'report_frequency' + messages -- and for the final timestamp, after all + expected messages have been received. +-*/ +static +double +get_time ( ) +{ + struct timeval tv; + struct tm * timeinfo; + + gettimeofday ( & tv, 0 ); + timeinfo = localtime ( & tv.tv_sec ); + + double time_now = 3600 * timeinfo->tm_hour + + 60 * timeinfo->tm_min + + timeinfo->tm_sec; + + time_now += ((double)(tv.tv_usec) / 100.0); + return time_now; +} + + + + + +/* + These absolute timestamps are useful in soak tests, + where I want to align the program's output with + output from top to look at CPU and memory use.. +*/ +void +print_timestamp_like_a_normal_person ( FILE * fp ) +{ + char const * month_abbrevs[] = { "jan", + "feb", + "mar", + "apr", + "may", + "jun", + "jul", + "aug", + "sep", + "oct", + "nov", + "dec" + }; + time_t rawtime; + struct tm * timeinfo; + + time ( & rawtime ); + timeinfo = localtime ( &rawtime ); + + char time_string[100]; + sprintf ( time_string, +"%d-%s-%02d %02d:%02d:%02d", +1900 + timeinfo->tm_year, +month_abbrevs[timeinfo->tm_mon], +timeinfo->tm_mday, +timeinfo->tm_hour, +timeinfo->tm_min, +timeinfo->tm_sec + ); + + fprintf ( fp, "timestamp %s\n", time_strin
svn commit: r1628274 - /qpid/proton/trunk/proton-c/src/codec/data.h
Author: mgoulish Date: Mon Sep 29 19:44:05 2014 New Revision: 1628274 URL: http://svn.apache.org/r1628274 Log: PROTON-700 By not saying 'static' on previous checkin, I broke debug builds. Modified: qpid/proton/trunk/proton-c/src/codec/data.h Modified: qpid/proton/trunk/proton-c/src/codec/data.h URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/codec/data.h?rev=1628274&r1=1628273&r2=1628274&view=diff == --- qpid/proton/trunk/proton-c/src/codec/data.h (original) +++ qpid/proton/trunk/proton-c/src/codec/data.h Mon Sep 29 19:44:05 2014 @@ -61,7 +61,7 @@ struct pn_data_t { pni_nid_t base_current; }; -inline pni_node_t * pn_data_node(pn_data_t *data, pni_nid_t nd) +static inline pni_node_t * pn_data_node(pn_data_t *data, pni_nid_t nd) { return nd ? (data->nodes + nd - 1) : NULL; } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1627642 - in /qpid/proton/trunk/proton-c/src/codec: codec.c data.h
Author: mgoulish Date: Thu Sep 25 20:13:20 2014 New Revision: 1627642 URL: http://svn.apache.org/r1627642 Log: PROTON-700 : small performance improvement from inlining pn_data_node(). This is a very popular function. improvement on newer box was 6% , on older box 2.6% t-test after 50 reps before & after says odd of the 2.6% figure happening by chance is 2.0e-18 . Modified: qpid/proton/trunk/proton-c/src/codec/codec.c qpid/proton/trunk/proton-c/src/codec/data.h Modified: qpid/proton/trunk/proton-c/src/codec/codec.c URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/codec/codec.c?rev=1627642&r1=1627641&r2=1627642&view=diff == --- qpid/proton/trunk/proton-c/src/codec/codec.c (original) +++ qpid/proton/trunk/proton-c/src/codec/codec.c Thu Sep 25 20:13:20 2014 @@ -,15 +,6 @@ int pn_data_resize(pn_data_t *data, size } -pni_node_t *pn_data_node(pn_data_t *data, pni_nid_t nd) -{ - if (nd) { -return &data->nodes[nd - 1]; - } else { -return NULL; - } -} - size_t pn_data_id(pn_data_t *data, pni_node_t *node) { return node - data->nodes + 1; Modified: qpid/proton/trunk/proton-c/src/codec/data.h URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/codec/data.h?rev=1627642&r1=1627641&r2=1627642&view=diff == --- qpid/proton/trunk/proton-c/src/codec/data.h (original) +++ qpid/proton/trunk/proton-c/src/codec/data.h Thu Sep 25 20:13:20 2014 @@ -61,7 +61,11 @@ struct pn_data_t { pni_nid_t base_current; }; -pni_node_t *pn_data_node(pn_data_t *data, pni_nid_t nd); +inline pni_node_t * pn_data_node(pn_data_t *data, pni_nid_t nd) +{ + return nd ? (data->nodes + nd - 1) : NULL; +} + int pni_data_traverse(pn_data_t *data, int (*enter)(void *ctx, pn_data_t *data, pni_node_t *node), int (*exit)(void *ctx, pn_data_t *data, pni_node_t *node), - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1612838 - /qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp
Author: mgoulish Date: Wed Jul 23 14:02:42 2014 New Revision: 1612838 URL: http://svn.apache.org/r1612838 Log: QPID-5815 Checkin for Irina Boverman. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp?rev=1612838&r1=1612837&r2=1612838&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Wed Jul 23 14:02:42 2014 @@ -301,6 +301,11 @@ void CyrusAuthenticator::init() SecuritySettings external = connection.getExternalSecuritySettings(); QPID_LOG(debug, "External ssf=" << external.ssf << " and auth=" << external.authid); sasl_ssf_t external_ssf = (sasl_ssf_t) external.ssf; + +if ((external_ssf) && (external.authid.empty())) { +QPID_LOG(warning, "SASL error: unable to offer EXTERNAL mechanism as authid cannot be determined"); +} + if (external_ssf) { int result = sasl_setprop(sasl_conn, SASL_SSF_EXTERNAL, &external_ssf); if (result != SASL_OK) { - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1612569 - /qpid/proton/trunk/proton-c/src/object/object.c
Author: mgoulish Date: Tue Jul 22 13:36:25 2014 New Revision: 1612569 URL: http://svn.apache.org/r1612569 Log: PROTON-625 In edge-case where map->load_factor exactly equals load, it was possible for pni_map_ensure() and pni_map_entry() to get into a semi-infinite loop. Modified: qpid/proton/trunk/proton-c/src/object/object.c Modified: qpid/proton/trunk/proton-c/src/object/object.c URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/object/object.c?rev=1612569&r1=1612568&r2=1612569&view=diff == --- qpid/proton/trunk/proton-c/src/object/object.c (original) +++ qpid/proton/trunk/proton-c/src/object/object.c Tue Jul 22 13:36:25 2014 @@ -520,7 +520,7 @@ static float pni_map_load(pn_map_t *map) static bool pni_map_ensure(pn_map_t *map, size_t capacity) { float load = pni_map_load(map); - if (capacity <= map->capacity && load < map->load_factor) { + if (capacity <= map->capacity && load <= map->load_factor) { return false; } - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1612559 - in /qpid/trunk/qpid/cpp/src/qpid: broker/SessionState.cpp broker/amqp_0_10/MessageTransfer.cpp framing/FrameSet.h
Author: mgoulish Date: Tue Jul 22 12:34:26 2014 New Revision: 1612559 URL: http://svn.apache.org/r1612559 Log: QPID-5910 The previous way of computing required credit was apparently pretty slow -- perhaps because it is doing some unnceessary copying down in its guts. (Which theory I did not prove.) And it was running while a lock was held, which caused a significant throughput regression (which was reported as an enormous latency regression.) The simpler means of calculating credit in this diff removes most of the problem. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp qpid/trunk/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp qpid/trunk/qpid/cpp/src/qpid/framing/FrameSet.h Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp?rev=1612559&r1=1612558&r2=1612559&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SessionState.cpp Tue Jul 22 12:34:26 2014 @@ -229,8 +229,9 @@ void SessionState::handleContent(AMQFram IncompleteIngressMsgXfer xfer(this, msg); msg->getIngressCompletion().begin(); -semanticState.route(deliverable.getMessage(), deliverable); +// This call should come before routing, because it calcs required credit. msgBuilder.end(); +semanticState.route(deliverable.getMessage(), deliverable); msg->getIngressCompletion().end(xfer); // allows msg to complete xfer } } Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp?rev=1612559&r1=1612558&r2=1612559&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp_0_10/MessageTransfer.cpp Tue Jul 22 12:34:26 2014 @@ -153,17 +153,27 @@ uint32_t MessageTransfer::getRequiredCre if (cachedRequiredCredit) { return requiredCredit; } else { -qpid::framing::SumBodySize sum; -frames.map_if(sum, qpid::framing::TypeFilter2()); -return sum.getSize(); +// TODO -- remove this code and replace it with a QPID_ASSERT(cachedRequiredCredit), +// then fix whatever breaks. compute should always be called before get. +uint32_t sum = 0; +for(FrameSet::Frames::const_iterator i = frames.begin(); i != frames.end(); ++i ) { +uint8_t type = (*i).getBody()->type(); +if ((type == qpid::framing::HEADER_BODY ) || (type == qpid::framing::CONTENT_BODY )) +sum += (*i).getBody()->encodedSize(); +} +return sum; } } void MessageTransfer::computeRequiredCredit() { //add up payload for all header and content frames in the frameset -qpid::framing::SumBodySize sum; -frames.map_if(sum, qpid::framing::TypeFilter2()); -requiredCredit = sum.getSize(); +uint32_t sum = 0; +for(FrameSet::Frames::const_iterator i = frames.begin(); i != frames.end(); ++i ) { +uint8_t type = (*i).getBody()->type(); +if ((type == qpid::framing::HEADER_BODY ) || (type == qpid::framing::CONTENT_BODY )) +sum += (*i).getBody()->encodedSize(); +} +requiredCredit = sum; cachedRequiredCredit = true; } Modified: qpid/trunk/qpid/cpp/src/qpid/framing/FrameSet.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/framing/FrameSet.h?rev=1612559&r1=1612558&r2=1612559&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/framing/FrameSet.h (original) +++ qpid/trunk/qpid/cpp/src/qpid/framing/FrameSet.h Tue Jul 22 12:34:26 2014 @@ -37,7 +37,10 @@ namespace framing { */ class FrameSet { +public: typedef InlineVector Frames; + +private: const SequenceNumber id; Frames parts; mutable uint64_t contentSize; - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1548607 - /qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
Author: mgoulish Date: Fri Dec 6 17:40:15 2013 New Revision: 1548607 URL: http://svn.apache.org/r1548607 Log: PROTON-260 Improve API rdoc comments for Ruby. Modified: qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb Modified: qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb?rev=1548607&r1=1548606&r2=1548607&view=diff == --- qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb (original) +++ qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb Fri Dec 6 17:40:15 2013 @@ -21,10 +21,39 @@ module Qpid module Proton -# A +Messenger+ provides a high-level means for sending and -# receiving AMQP messages. +# The +Messenger+ class defines a high level interface for +# sending and receiving Messages. Every Messenger contains +# a single logical queue of incoming messages and a single +# logical queue of outgoing messages. These messages in these +# queues may be destined for, or originate from, a variety of +# addresses. # -# Examples +# The messenger interface is single-threaded. All methods +# except one ( #interrupt ) are intended to be used from within +# the messenger thread. +# +# === Sending & Receiving Messages +# +# The Messenger class works in conjuction with the Message class. The +# Message class is a mutable holder of message content. +# +# The put method copies its Message to the outgoing queue, and may +# send queued messages if it can do so without blocking. The send +# method blocks until it has sent the requested number of messages, +# or until a timeout interrupts the attempt. +# +# Similarly, the recv method receives messages into the incoming +# queue, and may block as it attempts to receive the requested number +# of messages, or until timeout is reached. It may receive fewer +# than the requested number. The get method pops the +# eldest Message off the incoming queue and copies it into the Message +# object that you supply. It will not block. +# +# The blocking attribute allows you to turn off blocking behavior entirely, +# in which case send and recv will do whatever they can without +# blocking, and then return. You can then look at the number +# of incoming and outgoing messages to see how much outstanding work +# still remains. # class Messenger @@ -92,6 +121,12 @@ module Qpid Cproton.pn_messenger_get_timeout(@impl) end + # Blocking Attribute + # + # Enable or disable blocking behavior during message sending + # and receiving. This affects every blocking call, with the + # exception of work(). Currently, the affected calls are + # send, recv, and stop. def blocking Cproton.pn_mesenger_is_blocking(@impl) end @@ -118,8 +153,9 @@ module Qpid Cproton.pn_error_text(Cproton.pn_messenger_error(@impl)) end - # Starts the +Messenger+, allowing it to begin sending and - # receiving messages. + # Currently a no-op placeholder. + # For future compatibility, do not send or recv messages + # before starting the +Messenger+. # def start check_for_error(Cproton.pn_messenger_start(@impl)) @@ -132,11 +168,22 @@ module Qpid check_for_error(Cproton.pn_messenger_stop(@impl)) end + # Returns true iff a Messenger is in the stopped state. + # This function does not block. + # def stopped Cproton.pn_messenger_stopped(@impl) end - # Subscribes the +Messenger+ to a remote address. + # Subscribes the Messenger to messages originating from the + # specified source. The source is an address as specified in the + # Messenger introduction with the following addition. If the + # domain portion of the address begins with the '~' character, the + # Messenger will interpret the domain as host/port, bind to it, + # and listen for incoming messages. For example "~0.0.0.0", + # "amqp://~0.0.0.0" will all bind to any local interface and + # listen for incoming messages. Ad address of # "amqps://~0.0.0.0" + # will only permit incoming SSL connections. # def subscribe(address) raise TypeError.new("invalid address: #{address}") if address.nil? @@ -148,7 +195,10 @@ module Qpid # Path to a certificate file for the +Messenger+. # # This certificate is used when the +Messenger+ accepts or establishes - # SSL/TLS connections. + # SSL/TLS connections. This property must be specified for the + # Messenger to accept incoming
svn commit: r1537984 - /qpid/proton/trunk/proton-c/bindings/python/proton.py
Author: mgoulish Date: Fri Nov 1 16:51:28 2013 New Revision: 1537984 URL: http://svn.apache.org/r1537984 Log: PROTON-260 new text for python API doc. Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1537984&r1=1537983&r2=1537984&view=diff == --- qpid/proton/trunk/proton-c/bindings/python/proton.py (original) +++ qpid/proton/trunk/proton-c/bindings/python/proton.py Fri Nov 1 16:51:28 2013 @@ -161,6 +161,11 @@ class Messenger(object): of outgoing messages. These messages in these queues may be destined for, or originate from, a variety of addresses. + The messenger interface is single-threaded. All methods + except one (L{interrupt}) are intended to be used from within + the messenger thread. + + Address Syntax == @@ -187,12 +192,14 @@ class Messenger(object): Sending & Receiving Messages - The L{Messenger} class works in conjuction with the L{Message} - class. The L{Message} class is a mutable holder of message content. - The L{put} method will encode the content in a given L{Message} - object into the outgoing message queue leaving that L{Message} - object free to be modified or discarded without having any impact on - the content in the outgoing queue. + The L{Messenger} class works in conjuction with the L{Message} class. The + L{Message} class is a mutable holder of message content. + + The L{put} method copies its L{Message} to the outgoing queue, and may + send queued messages if it can do so without blocking. The L{send} + method blocks until it has sent the requested number of messages, + or until a timeout interrupts the attempt. + >>> message = Message() >>> for i in range(3): @@ -201,8 +208,13 @@ class Messenger(object): ... messenger.put(message) >>> messenger.send() - Similarly, the L{get} method will decode the content in the incoming - message queue into the supplied L{Message} object. + Similarly, the L{recv} method receives messages into the incoming + queue, and may block as it attempts to receive the requested number + of messages, or until timeout is reached. It may receive fewer + than the requested number. The L{get} method pops the + eldest L{Message} off the incoming queue and copies it into the L{Message} + object that you supply. It will not block. + >>> message = Message() >>> messenger.recv(10): @@ -212,6 +224,12 @@ class Messenger(object): Hello World 0 Hello World 1 Hello World 2 + + The blocking flag allows you to turn off blocking behavior entirely, + in which case L{send} and L{recv} will do whatever they can without + blocking, and then return. You can then look at the number + of incoming and outgoing messages to see how much outstanding work + still remains. """ def __init__(self, name=None): @@ -226,6 +244,11 @@ class Messenger(object): self._mng = pn_messenger(name) def __del__(self): +""" +Destroy the L{Messenger}. This will close all connections that +are managed by the L{Messenger}. Call the L{stop} method before +destroying the L{Messenger}. +""" if hasattr(self, "_mng"): pn_messenger_free(self._mng) del self._mng @@ -298,7 +321,7 @@ file, or None if the file is not encrypt trusted_certificates = property(_get_trusted_certificates, _set_trusted_certificates, doc=""" -A path do a database of trusted certificates for use in verifying the +A path to a database of trusted certificates for use in verifying the peer on an SSL/TLS connection. If this property is None, then the peer will not be verified. """) @@ -329,7 +352,13 @@ operations performed by the L{Messenger} def _set_blocking(self, b): self._check(pn_messenger_set_blocking(self._mng, b)) - blocking = property(_is_blocking, _set_blocking) + blocking = property(_is_blocking, _set_blocking, + doc=""" +Enable or disable blocking behavior during L{Message} sending +and receiving. This affects every blocking call, with the +exception of L{work}. Currently, the affected calls are +L{send}, L{recv}, and L{stop}. +""") def _get_incoming_window(self): return pn_messenger_get_incoming_window(self._mng) @@ -342,6 +371,12 @@ operations performed by the L{Messenger} The incoming tracking window for the messenger. The messenger will track the remote status of this many incoming deliveries after they have been accepted or rejected. Defaults to zero. + +L{Messages} enter t
svn commit: r1529999 - /qpid/proton/trunk/proton-c/include/proton/messenger.h
Author: mgoulish Date: Mon Oct 7 17:06:53 2013 New Revision: 152 URL: http://svn.apache.org/r152 Log: New comments for C API. Modified: qpid/proton/trunk/proton-c/include/proton/messenger.h Modified: qpid/proton/trunk/proton-c/include/proton/messenger.h URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/messenger.h?rev=152&r1=1529998&r2=152&view=diff == --- qpid/proton/trunk/proton-c/include/proton/messenger.h (original) +++ qpid/proton/trunk/proton-c/include/proton/messenger.h Mon Oct 7 17:06:53 2013 @@ -63,8 +63,10 @@ PN_EXTERN pn_messenger_t *pn_messenger(c */ PN_EXTERN const char *pn_messenger_name(pn_messenger_t *messenger); -/** Provides a certificate that will be used to identify the local - * Messenger to the peer. +/** Sets the path that will be used to get the certificate + * that will be used to identify this messenger to its + * peers. The validity of the path is not checked by + * this function. * * @param[in] messenger the messenger * @param[in] certificate a path to a certificate file @@ -73,7 +75,9 @@ PN_EXTERN const char *pn_messenger_name( */ PN_EXTERN int pn_messenger_set_certificate(pn_messenger_t *messenger, const char *certificate); -/** Gets the certificate file for a Messenger. +/** Return the certificate path. This value may be set by + * pn_messenger_set_certificate. The default certificate + * path is null. * * @param[in] messenger the messenger * @return the certificate file path @@ -131,8 +135,10 @@ PN_EXTERN int pn_messenger_set_trusted_c */ PN_EXTERN const char *pn_messenger_get_trusted_certificates(pn_messenger_t *messenger); -/** Sets the timeout for a Messenger. A negative timeout means - * infinite. +/** Any messenger call that blocks during execution will stop + * blocking and return control when this timeout is reached, + * if you have set it to a value greater than zero. + * Expressed in milliseconds. * * @param[in] messenger the messenger * @param[in] timeout the new timeout for the messenger, in milliseconds @@ -149,7 +155,21 @@ PN_EXTERN int pn_messenger_set_timeout(p */ PN_EXTERN int pn_messenger_get_timeout(pn_messenger_t *messenger); +/** Accessor for messenger blocking mode. + * + * @param[in] messenger the messenger + * + * @return true if blocking has been enabled. + */ PN_EXTERN bool pn_messenger_is_blocking(pn_messenger_t *messenger); + +/** Enable or disable blocking behavior during calls to + * pn_messenger_send and pn_messenger_recv. + * + * @param[in] messenger the messenger + * + * @return true if blocking has been enabled. + */ PN_EXTERN int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking); /** Frees a Messenger. @@ -159,7 +179,10 @@ PN_EXTERN int pn_messenger_set_blocking( */ PN_EXTERN void pn_messenger_free(pn_messenger_t *messenger); -/** Returns the error code for the Messenger. +/** Return the code for the most recent error, + * initialized to zero at messenger creation. + * The error number is "sticky" i.e. are not reset to 0 + * at the end of successful API calls. * * @param[in] messenger the messenger to check for errors * @@ -168,7 +191,9 @@ PN_EXTERN void pn_messenger_free(pn_mess */ PN_EXTERN int pn_messenger_errno(pn_messenger_t *messenger); -/** Returns the error info for a Messenger. +/** Returns a pointer to a pn_error_t. The pn_error_* API + * allows you to access the text, error number, and lets you + * set or clear the error code explicitly. * * @param[in] messenger the messenger to check for errors * @@ -177,8 +202,9 @@ PN_EXTERN int pn_messenger_errno(pn_mess */ PN_EXTERN pn_error_t *pn_messenger_error(pn_messenger_t *messenger); -/** Gets the outgoing window for a Messenger. @see - * ::pn_messenger_set_outgoing_window +/** Returns the size of the incoming window that was + * set with pn_messenger_set_incoming_window. The + * default is 0. * * @param[in] messenger the messenger * @@ -186,10 +212,11 @@ PN_EXTERN pn_error_t *pn_messenger_error */ PN_EXTERN int pn_messenger_get_outgoing_window(pn_messenger_t *messenger); -/** Sets the outgoing window for a Messenger. If the outgoing window - * is set to a positive value, then after each call to - * pn_messenger_send, the Messenger will track the status of that - * many deliveries. @see ::pn_messenger_status +/** The size of the outgoing window limits the number of messages whose + * status you can check with a tracker. A message enters this window + * when you call pn_messenger_put on the message. If your outgoing window + * size is 10, and you call pn_messenger_put 12, new status information + * will no longer be available for the first 2 messages. * * @param[in] messenger the Messenger * @param[in] window the number of deliveries to track @@ -199,8 +226,9 @@ PN_EXTERN int pn_messenger_get_outgoin
svn commit: r1480905 - in /qpid/proton/trunk/docs/markdown/messenger: addressing-and-routing.md message-disposition.md sending-and-receiving.md
Author: mgoulish Date: Fri May 10 07:53:03 2013 New Revision: 1480905 URL: http://svn.apache.org/r1480905 Log: PROTON-260 : Style changes to code parentheses, section headers, and emphasis designators. Modified: qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md qpid/proton/trunk/docs/markdown/messenger/message-disposition.md qpid/proton/trunk/docs/markdown/messenger/sending-and-receiving.md Modified: qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md?rev=1480905&r1=1480904&r2=1480905&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md Fri May 10 07:53:03 2013 @@ -64,11 +64,11 @@ Routing The Messenger library provides message routing capability with an address translation table. Each entry in the table -consists of a _pattern_ and a _translation_. +consists of a *pattern* and a *translation*. You store a new route entry in the table with the call: -pn_messenger_route ( messenger, pattern, translation ); +pn_messenger_route(messenger, pattern, translation); The address of each outgoing message is compared to the Modified: qpid/proton/trunk/docs/markdown/messenger/message-disposition.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/message-disposition.md?rev=1480905&r1=1480904&r2=1480905&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/message-disposition.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/message-disposition.md Fri May 10 07:53:03 2013 @@ -34,16 +34,16 @@ direction works similarly. ) When you call -pn_messenger_set_incoming_window ( messenger, window_size ); +pn_messenger_set_incoming_window(messenger, window_size); you have only declared the window size. The window is not yet created. The window will be created when you issue your first call to -pn_messenger_get ( messenger, msg ); +pn_messenger_get(messenger, msg); And the window will be further populated only by further calls to -pn_messenger_get ( ). +pn_messenger_get(). @@ -51,12 +51,12 @@ pn_messenger_get ( ). -### receiving ### +### Receiving ### To explicitly set or get message dispositions, your messenger must set a positive size for its incoming window: -pn_messenger_set_incoming_window ( messenger, N ); +pn_messenger_set_incoming_window(messenger, N); You can implicity accept messages by simply letting enough new messages arrive. As older messages pass beyond the threshold @@ -65,26 +65,26 @@ accepted. Thus, if you want to automati messages as they arrive, you can set your incoming window size to 0. -To exercise _explicit_ control over particular messages or ranges +To exercise *explicit* control over particular messages or ranges of messages, the receiver can use trackers. The call -pn_messenger_incoming_tracker ( messenger ); +pn_messenger_incoming_tracker(messenger); will return a tracker for the message most recently returned by a call to -pn_messenger_get ( messenger, message ); +pn_messenger_get(messenger, message); With a message that is being tracked, the messenger can accept (or reject) that individual message: -pn_messenger_accept ( messenger, tracker, 0 ); -pn_messenger_reject ( messenger, tracker, 0 ); +pn_messenger_accept(messenger, tracker, 0); +pn_messenger_reject(messenger, tracker, 0); Or it can accept (or reject) the tracked message as well as all older messages back to the limit of the incoming window: -pn_messenger_accept ( messenger, tracker, PN_CUMULATIVE ); -pn_messenger_reject ( messenger, tracker, PN_CUMULATIVE ); +pn_messenger_accept(messenger, tracker, PN_CUMULATIVE); +pn_messenger_reject(messenger, tracker, PN_CUMULATIVE); Once a message is accepted or rejected, its status can no longer be changed, even if you have a separate tracker associated with it. @@ -93,10 +93,10 @@ be changed, even if you have a separate -###when to accept### +###When to Accept### -Although you _can_ accept messages implicitly by letting them fall -off the edge of your incoming window, you _shouldn't_. Message +Although you *can* accept messages implicitly by letting them fall +off the edge of your incoming window, you *shouldn't*. Message disposition is an important form of communication to the sender. The best practice is to let the sender know your response, by explicit acceptance or rejection, as soon as you can. Implicitly @@ -109,7 +109,7 @@ how mu
svn commit: r1479686 - /qpid/proton/trunk/docs/markdown/messenger/message-disposition.md
Author: mgoulish Date: Mon May 6 19:26:15 2013 New Revision: 1479686 URL: http://svn.apache.org/r1479686 Log: PROTON-260 : improved description of windowing Modified: qpid/proton/trunk/docs/markdown/messenger/message-disposition.md Modified: qpid/proton/trunk/docs/markdown/messenger/message-disposition.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/message-disposition.md?rev=1479686&r1=1479685&r2=1479686&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/message-disposition.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/message-disposition.md Mon May 6 19:26:15 2013 @@ -24,6 +24,32 @@ Windows and Trackers +Messenger does not track the disposition of every message that +it sends or receives. To set (or get) the disposition of a +message, that message must be within your incoming (or outgoing) +window. + +( I will use the incoming direction as the example. The outgoing +direction works similarly. ) + +When you call + +pn_messenger_set_incoming_window ( messenger, window_size ); + +you have only declared the window size. The window is not yet +created. The window will be created when you issue your first +call to + +pn_messenger_get ( messenger, msg ); + +And the window will be further populated only by further calls to +pn_messenger_get ( ). + + + + + + ### receiving ### @@ -78,14 +104,29 @@ accepting messages by allowing them to f incoming window could delay your response to the sender for an unpredictable amount of time. -The purpose of a nonzero window size is really to place -a limit on how much state your Messenger needs to track. +A nonzero window size places a limit on +how much state your Messenger needs to track. ###accepting by accident -_This section coming soon._ +If you allow a message to "fall off the edge" of your incoming +window before you have explicitly accepted or rejected it, then +it will be accepted automatically. + +But since your incoming window is only filled by calls to + +pn_messenger_get ( messenger, msg ); + +messages cannot be forced to fall over the edge by simply +receiving more messages. Messages will not be forced over the +edge of the incoming window unless you make too many calls to +`pn_messenger_get()` without explicitly accepting or rejecting +the messages. + +Your application should accept or reject each message as soon +as practical after getting and processing it. @@ -133,19 +174,8 @@ settled messages. -### windows do not fill up ### -When your incoming window fills up with messages it does not stop -you from receiving more messages. If your incoming window has size *N* -the only effect of receiving *N+1* messages is that the oldest message -is automatically accepted (if you have not already accepted or rejected -it). - -If your outgoing window fills, and new messages going out force the -oldest ones to fall off the edge, your application will just lose -the ability to track those oldest messages. - -_Note_ +### message rejection ### If a message is rejected by the receiver, it does not mean that the message was malformed. Malformed messages cannot be sent. Even messages with no content are valid messages. @@ -157,7 +187,7 @@ or to send the message to another receiv The AMQP 1.0 specification permits a distinction between _rejecting_ the message, and _releasing_ the message, -but the Proton library does not (yet) expose the _releasing_ +but the Proton library does not expose the _releasing_ disposition. - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1477724 - in /qpid/trunk/qpid/cpp: BuildInstallSettings.cmake src/Makefile.am src/config.h.cmake src/qpid/broker/Broker.cpp
Author: mgoulish Date: Tue Apr 30 17:04:46 2013 New Revision: 1477724 URL: http://svn.apache.org/r1477724 Log: QPID-4759 : make qpidd --help display sasl config dir default location Backing out my previous changes and just changing the help comment for the --sasl-config flag. Modified: qpid/trunk/qpid/cpp/BuildInstallSettings.cmake qpid/trunk/qpid/cpp/src/Makefile.am qpid/trunk/qpid/cpp/src/config.h.cmake qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Modified: qpid/trunk/qpid/cpp/BuildInstallSettings.cmake URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/BuildInstallSettings.cmake?rev=1477724&r1=1477723&r2=1477724&view=diff == --- qpid/trunk/qpid/cpp/BuildInstallSettings.cmake (original) +++ qpid/trunk/qpid/cpp/BuildInstallSettings.cmake Tue Apr 30 17:04:46 2013 @@ -184,7 +184,6 @@ if (UNIX) set_absolute_install_path (QPIDC_MODULE_DIR ${QPID_INSTALL_LIBDIR}/qpid/client) # Directory to load client plug-in modules from set_absolute_install_path (QPIDD_MODULE_DIR ${QPID_INSTALL_LIBDIR}/qpid/daemon) # Directory to load broker plug-in modules from - set_absolute_install_path (QPIDD_SASLCONF_DIR ${QPID_INSTALL_SASLDIR}) # Directory to put Cyrus SASL config files into # # Set RPATH so that installe executables can run without setting Modified: qpid/trunk/qpid/cpp/src/Makefile.am URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/Makefile.am?rev=1477724&r1=1477723&r2=1477724&view=diff == --- qpid/trunk/qpid/cpp/src/Makefile.am (original) +++ qpid/trunk/qpid/cpp/src/Makefile.am Tue Apr 30 17:04:46 2013 @@ -140,7 +140,7 @@ qpidtest_SCRIPTS = tmoduleexecdir = $(libdir)/qpid/tests tmoduleexec_LTLIBRARIES= -BROKER_CXXFLAGS = -D_IN_QPID_BROKER -DQPIDD_SASLCONF_DIR=\"$(sysconfdir)/sasl2\" +BROKER_CXXFLAGS = -D_IN_QPID_BROKER ## Automake macros to build libraries and executables. qpidd_CXXFLAGS = $(AM_CXXFLAGS) $(BROKER_CXXFLAGS) -DQPIDD_MODULE_DIR=\"$(dmoduleexecdir)\" -DQPIDD_CONF_FILE=\"$(sysconfdir)/qpidd.conf\" -DQPIDC_CONF_FILE=\"$(confdir)/qpidc.conf\" Modified: qpid/trunk/qpid/cpp/src/config.h.cmake URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/config.h.cmake?rev=1477724&r1=1477723&r2=1477724&view=diff == --- qpid/trunk/qpid/cpp/src/config.h.cmake (original) +++ qpid/trunk/qpid/cpp/src/config.h.cmake Tue Apr 30 17:04:46 2013 @@ -53,7 +53,6 @@ #cmakedefine QPID_HAS_CLOCK_GETTIME #cmakedefine BROKER_SASL_NAME "${BROKER_SASL_NAME}" -#cmakedefine QPIDD_SASLCONF_DIR "${QPIDD_SASLCONF_DIR}" #cmakedefine HAVE_SASL ${HAVE_SASL} #cmakedefine HAVE_OPENAIS_CPG_H ${HAVE_OPENAIS_CPG_H} Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1477724&r1=1477723&r2=1477724&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Tue Apr 30 17:04:46 2013 @@ -136,7 +136,6 @@ Broker::Options::Options(const std::stri tcpNoDelay(true), requireEncrypted(false), knownHosts(knownHostsNone), -saslConfigPath(QPIDD_SASLCONF_DIR), qmf2Support(true), qmf1Support(true), queueFlowStopRatio(80), @@ -178,7 +177,7 @@ Broker::Options::Options(const std::stri ("tcp-nodelay", optValue(tcpNoDelay), "Set TCP_NODELAY on TCP connections") ("require-encryption", optValue(requireEncrypted), "Only accept connections that are encrypted") ("known-hosts-url", optValue(knownHosts, "URL or 'none'"), "URL to send as 'known-hosts' to clients ('none' implies empty list)") -("sasl-config", optValue(saslConfigPath, "DIR"), "gets sasl config info from nonstandard location") +("sasl-config", optValue(saslConfigPath, "DIR"), "Allows SASL config path, if supported by platform, to be overridden. For default location on Linux, see Cyrus SASL documentation. There is no SASL config dir on Windows.") ("default-flow-stop-threshold", optValue(queueFlowStopRatio, "PERCENT"), "Percent of queue's maximum capacity at which flow control is activated.") ("default-flow-resume-threshold", optValue(queueFlowResumeRatio, "PERCENT"), "Percent of queue's maximum capacity at which flow control is de-activated.") ("default-event-threshold-ratio", optValue(queueThresholdEventRatio, "%age of limit"), "The ratio of any specified queue limit at which an event will be raised") - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1477435 - in /qpid/trunk/qpid/cpp: BuildInstallSettings.cmake src/Makefile.am src/config.h.cmake src/qpid/broker/Broker.cpp
Author: mgoulish Date: Tue Apr 30 01:07:02 2013 New Revision: 1477435 URL: http://svn.apache.org/r1477435 Log: QPID-4759 : make both builds put sasl config file in sysconfdir/sasl2 and display default location in qpidd --help output Modified: qpid/trunk/qpid/cpp/BuildInstallSettings.cmake qpid/trunk/qpid/cpp/src/Makefile.am qpid/trunk/qpid/cpp/src/config.h.cmake qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Modified: qpid/trunk/qpid/cpp/BuildInstallSettings.cmake URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/BuildInstallSettings.cmake?rev=1477435&r1=1477434&r2=1477435&view=diff == --- qpid/trunk/qpid/cpp/BuildInstallSettings.cmake (original) +++ qpid/trunk/qpid/cpp/BuildInstallSettings.cmake Tue Apr 30 01:07:02 2013 @@ -184,6 +184,7 @@ if (UNIX) set_absolute_install_path (QPIDC_MODULE_DIR ${QPID_INSTALL_LIBDIR}/qpid/client) # Directory to load client plug-in modules from set_absolute_install_path (QPIDD_MODULE_DIR ${QPID_INSTALL_LIBDIR}/qpid/daemon) # Directory to load broker plug-in modules from + set_absolute_install_path (QPIDD_SASLCONF_DIR ${QPID_INSTALL_SASLDIR}) # Directory to put Cyrus SASL config files into # # Set RPATH so that installe executables can run without setting Modified: qpid/trunk/qpid/cpp/src/Makefile.am URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/Makefile.am?rev=1477435&r1=1477434&r2=1477435&view=diff == --- qpid/trunk/qpid/cpp/src/Makefile.am (original) +++ qpid/trunk/qpid/cpp/src/Makefile.am Tue Apr 30 01:07:02 2013 @@ -140,7 +140,7 @@ qpidtest_SCRIPTS = tmoduleexecdir = $(libdir)/qpid/tests tmoduleexec_LTLIBRARIES= -BROKER_CXXFLAGS = -D_IN_QPID_BROKER +BROKER_CXXFLAGS = -D_IN_QPID_BROKER -DQPIDD_SASLCONF_DIR=\"$(sysconfdir)/sasl2\" ## Automake macros to build libraries and executables. qpidd_CXXFLAGS = $(AM_CXXFLAGS) $(BROKER_CXXFLAGS) -DQPIDD_MODULE_DIR=\"$(dmoduleexecdir)\" -DQPIDD_CONF_FILE=\"$(sysconfdir)/qpidd.conf\" -DQPIDC_CONF_FILE=\"$(confdir)/qpidc.conf\" Modified: qpid/trunk/qpid/cpp/src/config.h.cmake URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/config.h.cmake?rev=1477435&r1=1477434&r2=1477435&view=diff == --- qpid/trunk/qpid/cpp/src/config.h.cmake (original) +++ qpid/trunk/qpid/cpp/src/config.h.cmake Tue Apr 30 01:07:02 2013 @@ -53,6 +53,7 @@ #cmakedefine QPID_HAS_CLOCK_GETTIME #cmakedefine BROKER_SASL_NAME "${BROKER_SASL_NAME}" +#cmakedefine QPIDD_SASLCONF_DIR "${QPIDD_SASLCONF_DIR}" #cmakedefine HAVE_SASL ${HAVE_SASL} #cmakedefine HAVE_OPENAIS_CPG_H ${HAVE_OPENAIS_CPG_H} Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1477435&r1=1477434&r2=1477435&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Tue Apr 30 01:07:02 2013 @@ -136,6 +136,7 @@ Broker::Options::Options(const std::stri tcpNoDelay(true), requireEncrypted(false), knownHosts(knownHostsNone), +saslConfigPath(QPIDD_SASLCONF_DIR), qmf2Support(true), qmf1Support(true), queueFlowStopRatio(80), - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1470106 - /qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
Author: mgoulish Date: Sat Apr 20 04:27:50 2013 New Revision: 1470106 URL: http://svn.apache.org/r1470106 Log: QPID-4759 : backed out change -- can't hard-code Cyrus SASL default. bad for Windows. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1470106&r1=1470105&r2=1470106&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Sat Apr 20 04:27:50 2013 @@ -136,7 +136,6 @@ Broker::Options::Options(const std::stri tcpNoDelay(true), requireEncrypted(false), knownHosts(knownHostsNone), -saslConfigPath("/etc/sasl2"), qmf2Support(true), qmf1Support(true), queueFlowStopRatio(80), - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1470104 - /qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
Author: mgoulish Date: Sat Apr 20 04:15:59 2013 New Revision: 1470104 URL: http://svn.apache.org/r1470104 Log: QPID-4759 : make --help output show default value for --sasl-config Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1470104&r1=1470103&r2=1470104&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Sat Apr 20 04:15:59 2013 @@ -136,6 +136,7 @@ Broker::Options::Options(const std::stri tcpNoDelay(true), requireEncrypted(false), knownHosts(knownHostsNone), +saslConfigPath("/etc/sasl2"), qmf2Support(true), qmf1Support(true), queueFlowStopRatio(80), - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1469336 - /qpid/proton/trunk/docs/markdown/messenger/message-disposition.md
Author: mgoulish Date: Thu Apr 18 14:12:24 2013 New Revision: 1469336 URL: http://svn.apache.org/r1469336 Log: PROTON-260 : deleted some false info, replaced it with coming-soon note for now Modified: qpid/proton/trunk/docs/markdown/messenger/message-disposition.md Modified: qpid/proton/trunk/docs/markdown/messenger/message-disposition.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/message-disposition.md?rev=1469336&r1=1469335&r2=1469336&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/message-disposition.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/message-disposition.md Thu Apr 18 14:12:24 2013 @@ -4,17 +4,17 @@ Message Disposition Messenger disposition operations allow a receiver to accept or reject specific messages, or ranges of messages. Senders can -detect the disposition of their messages. +then detect the disposition of their messages. Message States --- Messages have one of four different states: - * `PN_STATUS_UNKNOWN` - * `PN_STATUS_PENDING` - * `PN_STATUS_ACCEPTED` - * `PN_STATUS_REJECTED` +`PN_STATUS_UNKNOWN` +`PN_STATUS_PENDING` +`PN_STATUS_ACCEPTED` +`PN_STATUS_REJECTED` @@ -66,6 +66,7 @@ be changed, even if you have a separate + ###when to accept### Although you _can_ accept messages implicitly by letting them fall @@ -80,6 +81,13 @@ unpredictable amount of time. The purpose of a nonzero window size is really to place a limit on how much state your Messenger needs to track. + + +###accepting by accident + +_This section coming soon._ + + @@ -120,7 +128,7 @@ be settled, with one of these calls: pn_messenger_settle ( messenger, tracker, 0 ); pn_messenger_settle ( messenger, tracker, PN_CUMULATIVE ); -then the sender will see `PN_STATUS_UNKNOWN` as the status of any +then the sender will see `PN_STATUS_PENDING` as the status of any settled messages. - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1469326 - in /qpid/proton/trunk/docs/markdown/messenger: addressing_and_routing.md message_disposition.md quick_start_linux.md sending_and_receiving.md
Author: mgoulish Date: Thu Apr 18 13:49:14 2013 New Revision: 1469326 URL: http://svn.apache.org/r1469326 Log: PROTON-260 : removing old files Removed: qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md qpid/proton/trunk/docs/markdown/messenger/message_disposition.md qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md qpid/proton/trunk/docs/markdown/messenger/sending_and_receiving.md - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1469325 - in /qpid/proton/trunk/docs/markdown/messenger: addressing-and-routing.md index.md message-disposition.md quick-start-linux.md sending-and-receiving.md
Author: mgoulish Date: Thu Apr 18 13:47:40 2013 New Revision: 1469325 URL: http://svn.apache.org/r1469325 Log: PROTON-260 : name change for all doc files, add title to index Added: qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md qpid/proton/trunk/docs/markdown/messenger/message-disposition.md qpid/proton/trunk/docs/markdown/messenger/quick-start-linux.md qpid/proton/trunk/docs/markdown/messenger/sending-and-receiving.md Modified: qpid/proton/trunk/docs/markdown/messenger/index.md Added: qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md?rev=1469325&view=auto == --- qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md (added) +++ qpid/proton/trunk/docs/markdown/messenger/addressing-and-routing.md Thu Apr 18 13:47:40 2013 @@ -0,0 +1,210 @@ + +Messenger Addressing and Routing += + + +Addressing +- + +An address has the following form: + + [ amqp[s]:// ] [user[:password]@] domain [/[name]] + +Where domain can be one of: + + host | host:port | ip | ip:port | name + +The following are valid examples of addresses: + +* example.org +* example.org:1234 +* amqp://example.org +* amqps://example.org +* example.org/incoming +* amqps://example.org/outgoing +* amqps://fred:trust...@example.org +* 127.0.0.1:1234 +* amqps://127.0.0.1:1234 + +The "/name" part of the address, that optionally follows +the domain, is not used by the Messenger library. +For example, if a receiver subscribes to + +amqp://~0.0.0.0:5678 + +Then it will receive messages sent to + +amqp://~0.0.0.0:5678 +as well as +amqp://~0.0.0.0:5678/foo + + +Likewise, if the receiver subscribes to + +amqp://~0.0.0.0:5678/foo + +it will receive messages addressed to + +amqp://~0.0.0.0:5678/foo +amqp://~0.0.0.0:5678 + +and + +amqp://~0.0.0.0:5678/bar + + + + + + +Routing +-- + +### Pattern Matching, Address Translation, and Message Routing ### + +The Messenger library provides message routing capability +with an address translation table. Each entry in the table +consists of a _pattern_ and a _translation_. + +You store a new route entry in the table with the call: + +pn_messenger_route ( messenger, pattern, translation ); + + +The address of each outgoing message is compared to the +table's patterns until the first matching pattern is found, +or until all patterns have failed to match. + +If no pattern matches, then Messenger will send (or attempt +to send) your message with the address as given. + +If a pattern does match your outgoing message's address, then +Messenger will create a temporary address by transforming +your message's address. Your message will be sent to the +transformed address, but **(note!)** the address on your +outgoing message will not be changed. The receiver will see +the original, not the transformed address. + + + + +### Two Translation Mechanisms ### + + +Messenger uses two mechanisms to translate addresses. +The first is simple string substitution. + + +pattern: COLOSSUS +translation: amqp://0.0.0.0: +input addr: COLOSSUS +result: amqp://0.0.0.0: + + +The second mechanism is wildcard/variable substitution. +A wildcard in the pattern matches all or part of your +input address. The part of your input address that matched +the wildcard is stored. The matched value is then inserted +into your translated address in place of numbered variables: +$1, $2, and so on, up to a maximum of 64. + +There are two wildcards: * and % . +The rules for matching are: + +* matches anything +% matches anything but a / +other characters match themselves +the whole input addr must be matched + + +Examples of wildcard matching: + +pattern: /%/%/% +translation: $1x$2x$3 +input addr: /foo/bar/baz +result: fooxbarxbaz + +pattern: * +translation: $1 +inout addr: /foo/bar/baz +result: /foo/bar/baz + +pattern: /* +translation: $1 +input addr: /foo/bar/baz +result: foo/bar/baz + +pattern: /*baz +translation: $1 +input addr: /foo/bar/baz +result: foo/bar/ + +pattern: /%baz +translation: $1 +input addr: /foo/bar/baz +result: FAIL + +pattern: /%/baz +translation: $1 +input addr: /foo/bar/baz +result: FAIL + +pattern: /%/%/baz +translation: $1 +input addr: /foo/bar/baz +result: foo +
svn commit: r1469002 - /qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md
Author: mgoulish Date: Wed Apr 17 17:17:25 2013 New Revision: 1469002 URL: http://svn.apache.org/r1469002 Log: PROTON-260 : small content and markdown formatting change Modified: qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md Modified: qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md?rev=1469002&r1=1469001&r2=1469002&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md Wed Apr 17 17:17:25 2013 @@ -56,10 +56,11 @@ and + Routing -- -### Pattern Matching and Address Translation ### +### Pattern Matching, Address Translation, and Message Routing ### The Messenger library provides message routing capability with an address translation table. Each entry in the table @@ -199,6 +200,7 @@ Examples of route translation usage: + ### First Match Wins ### If you create multiple routing rules, each new rule is appended - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1468982 - /qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md
Author: mgoulish Date: Wed Apr 17 15:56:16 2013 New Revision: 1468982 URL: http://svn.apache.org/r1468982 Log: PROTON-260 : Changes after review-board input Modified: qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md Modified: qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md?rev=1468982&r1=1468981&r2=1468982&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/quick_start_linux.md Wed Apr 17 15:56:16 2013 @@ -1,9 +1,9 @@ -Linux Quick Start +Linux Proton Messenger Quick Start == On a Linux system, these instructions take you from -zero to running your first example code. You will +zero to running your first example code. You will need root privileges for one of the commands. @@ -15,37 +15,59 @@ Prerequisite Packages For a minimum build, you will need packages installed on your box for : -subversion -gcc -cmake -libuuid-devel +subversion +gcc +cmake +libuuid-devel Quick Start Commands --- -mkdir ~/proton -cd ~/proton -svn co http://svn.apache.org/repos/asf/qpid/proton/trunk -cd ./trunk +svn co http://svn.apache.org/repos/asf/qpid/proton/trunk proton +cd ./proton mkdir ./build cd ./build -cmake -DCMAKE_INSTALL_PREFIX=/usr .. +cmake .. make all # Become root and go to your build dir. make install # Stop being root. # Now let's see if it works. -cd ~/proton/trunk/examples/messenger/c -cmake . -make +cd ./proton-c/examples/messenger/c ./recv & ./send -# You're done ! +# You're done ! ( Kill that recv process. ) # The output you should see: Address: amqp://0.0.0.0 Subject: (no subject) Content: "Hello World!" + + + + +Notes + + +1. If you will be editing and checking in code from this tree, + replace the "svn co" line with this: + +svn co https://svn.apache.org/repos/asf/qpid/proton/trunk + + You must check out through https, or you will not be able to + check in code changes from your tree. + + +2. The recv application in the example defaults to the same port + as the qpid demon. If you happen to have that demon running, + and using the default port, the recv app above will fail. + + +3. If you don't have root privileges, you can still do the + "make install" step by setting a non-standard prefix, thus: +cmake -DCMAKE_INSTALL_PREFIX=/my/path .. + + - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1468073 - /qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md
Author: mgoulish Date: Mon Apr 15 13:49:21 2013 New Revision: 1468073 URL: http://svn.apache.org/r1468073 Log: PROTON-260: initial checkin of addressing_and_routing.md Added: qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md Added: qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md?rev=1468073&view=auto == --- qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md (added) +++ qpid/proton/trunk/docs/markdown/messenger/addressing_and_routing.md Mon Apr 15 13:49:21 2013 @@ -0,0 +1,208 @@ + +Messenger Addressing and Routing += + + +Addressing +- + +An address has the following form: + + [ amqp[s]:// ] [user[:password]@] domain [/[name]] + +Where domain can be one of: + + host | host:port | ip | ip:port | name + +The following are valid examples of addresses: + +* example.org +* example.org:1234 +* amqp://example.org +* amqps://example.org +* example.org/incoming +* amqps://example.org/outgoing +* amqps://fred:trust...@example.org +* 127.0.0.1:1234 +* amqps://127.0.0.1:1234 + +The "/name" part of the address, that optionally follows +the domain, is not used by the Messenger library. +For example, if a receiver subscribes to + +amqp://~0.0.0.0:5678 + +Then it will receive messages sent to + +amqp://~0.0.0.0:5678 +as well as +amqp://~0.0.0.0:5678/foo + + +Likewise, if the receiver subscribes to + +amqp://~0.0.0.0:5678/foo + +it will receive messages addressed to + +amqp://~0.0.0.0:5678/foo +amqp://~0.0.0.0:5678 + +and + +amqp://~0.0.0.0:5678/bar + + + + + +Routing +-- + +### Pattern Matching and Address Translation ### + +The Messenger library provides message routing capability +with an address translation table. Each entry in the table +consists of a _pattern_ and a _translation_. + +You store a new route entry in the table with the call: + +pn_messenger_route ( messenger, pattern, translation ); + + +The address of each outgoing message is compared to the +table's patterns until the first matching pattern is found, +or until all patterns have failed to match. + +If no pattern matches, then Messenger will send (or attempt +to send) your message with the address as given. + +If a pattern does match your outgoing message's address, then +Messenger will create a temporary address by transforming +your message's address. Your message will be sent to the +transformed address, but **(note!)** the address on your +outgoing message will not be changed. The receiver will see +the original, not the transformed address. + + + + +### Two Translation Mechanisms ### + + +Messenger uses two mechanisms to translate addresses. +The first is simple string substitution. + + +pattern: COLOSSUS +translation: amqp://0.0.0.0: +input addr: COLOSSUS +result: amqp://0.0.0.0: + + +The second mechanism is wildcard/variable substitution. +A wildcard in the pattern matches all or part of your +input address. The part of your input address that matched +the wildcard is stored. The matched value is then inserted +into your translated address in place of numbered variables: +$1, $2, and so on, up to a maximum of 64. + +There are two wildcards: * and % . +The rules for matching are: + +* matches anything +% matches anything but a / +other characters match themselves +the whole input addr must be matched + + +Examples of wildcard matching: + +pattern: /%/%/% +translation: $1x$2x$3 +input addr: /foo/bar/baz +result: fooxbarxbaz + +pattern: * +translation: $1 +inout addr: /foo/bar/baz +result: /foo/bar/baz + +pattern: /* +translation: $1 +input addr: /foo/bar/baz +result: foo/bar/baz + +pattern: /*baz +translation: $1 +input addr: /foo/bar/baz +result: foo/bar/ + +pattern: /%baz +translation: $1 +input addr: /foo/bar/baz +result: FAIL + +pattern: /%/baz +translation: $1 +input addr: /foo/bar/baz +result: FAIL + +pattern: /%/%/baz +translation: $1 +input addr: /foo/bar/baz +result: foo + +pattern: /*/baz +translation: $1 +input addr: /foo/bar/baz +result: foo/bar + + +Examples of route translation usage: + +pattern: foo +translation: amqp://foo.com +explanation: Any message sent to "foo&q
svn commit: r1464967 - /qpid/proton/trunk/docs/markdown/messenger/index.md
Author: mgoulish Date: Fri Apr 5 13:12:47 2013 New Revision: 1464967 URL: http://svn.apache.org/r1464967 Log: PROTON-200 : Add descriptive text to messenger docs index file Modified: qpid/proton/trunk/docs/markdown/messenger/index.md Modified: qpid/proton/trunk/docs/markdown/messenger/index.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/index.md?rev=1464967&r1=1464966&r2=1464967&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/index.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/index.md Fri Apr 5 13:12:47 2013 @@ -1,8 +1,8 @@ -See the following Messenger documents: +Proton Messenger is a high-level API that lets you build simple but powerful messaging systems. -[Linux Quick Start](quick_start_linux.html) +- Use the [Linux Quick Start](quick_start_linux.html) to download, build, and run your first Messenger example in two minutes. -[Sending and Receiving](sending_and_receiving.html) +- Examples and explanations of Messenger's [Sending and Receiving](sending_and_receiving.html) capabilities. -[Message Disposition](message_disposition.html) +- Use [Message Disposition](message_disposition.html) functionality to create reliable messaging systems. - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1464126 - /qpid/proton/trunk/docs/markdown/messenger/message_disposition.md
Author: mgoulish Date: Wed Apr 3 17:59:15 2013 New Revision: 1464126 URL: http://svn.apache.org/r1464126 Log: PROTON-260 : changes to reflect feedback from Rafi and Alan Modified: qpid/proton/trunk/docs/markdown/messenger/message_disposition.md Modified: qpid/proton/trunk/docs/markdown/messenger/message_disposition.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/markdown/messenger/message_disposition.md?rev=1464126&r1=1464125&r2=1464126&view=diff == --- qpid/proton/trunk/docs/markdown/messenger/message_disposition.md (original) +++ qpid/proton/trunk/docs/markdown/messenger/message_disposition.md Wed Apr 3 17:59:15 2013 @@ -10,11 +10,11 @@ detect the disposition of their messages Message States --- -Messages have one of four different states: - * `PN_STATUS_UNKNOWN` - * `PN_STATUS_PENDING` - * `PN_STATUS_ACCEPTED` - * `PN_STATUS_REJECTED` +Messages have one of four different states: + * `PN_STATUS_UNKNOWN` + * `PN_STATUS_PENDING` + * `PN_STATUS_ACCEPTED` + * `PN_STATUS_REJECTED` @@ -64,8 +64,27 @@ Once a message is accepted or rejected, be changed, even if you have a separate tracker associated with it. + + +###when to accept### + +Although you _can_ accept messages implicitly by letting them fall +off the edge of your incoming window, you _shouldn't_. Message +disposition is an important form of communication to the sender. +The best practice is to let the sender know your response, by +explicit acceptance or rejection, as soon as you can. Implicitly +accepting messages by allowing them to fall off the edge of the +incoming window could delay your response to the sender for an +unpredictable amount of time. + +The purpose of a nonzero window size is really to place +a limit on how much state your Messenger needs to track. + + + + ### sending ### @@ -75,7 +94,7 @@ if it has a positive outgoing window siz pn_messenger_set_outgoing_window ( messenger, N ); -and if a tracker has been associated with that message in question. +and if a tracker has been associated with that message in question. This call: pn_messenger_outgoing_tracker ( messenger ); @@ -92,7 +111,7 @@ The returned value will be one of * `PN_STATUS_ACCEPTED` * `PN_STATUS_REJECTED` , or -* `PN_STATUS_PENDING` - If the receiver has not disposed the message yet. +* `PN_STATUS_PENDING` - If the receiver has not disposed the message yet. If either the sender or the receiver simply declares the message (or range of messages) to @@ -106,15 +125,34 @@ settled messages. -_Note_ +### windows do not fill up ### +When your incoming window fills up with messages it does not stop +you from receiving more messages. If your incoming window has size *N* +the only effect of receiving *N+1* messages is that the oldest message +is automatically accepted (if you have not already accepted or rejected +it). + +If your outgoing window fills, and new messages going out force the +oldest ones to fall off the edge, your application will just lose +the ability to track those oldest messages. + + +_Note_ If a message is rejected by the receiver, it does not mean that the message was malformed. Malformed messages cannot be sent. Even messages with no content are valid messages. Rejection by a receiver should be understood as the receiver -saying "I don't want this." or possibly "I don't want this _yet_." -dependeing on your application. -The sender could decide to try sending the same message again later, +saying "I don't want this." or possibly "I don't want this _yet_." +depending on your application. +The sender could decide to try sending the same message again later, or to send the message to another receiver, or to discard it. +The AMQP 1.0 specification permits a distinction +between _rejecting_ the message, and _releasing_ the message, +but the Proton library does not (yet) expose the _releasing_ +disposition. + + + - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1456600 - /qpid/proton/trunk/docs/messenger/message_disposition.md
Author: mgoulish Date: Thu Mar 14 18:29:52 2013 New Revision: 1456600 URL: http://svn.apache.org/r1456600 Log: PROTON-260 Initial checkin of message_disposition.md Added: qpid/proton/trunk/docs/messenger/message_disposition.md Added: qpid/proton/trunk/docs/messenger/message_disposition.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/messenger/message_disposition.md?rev=1456600&view=auto == --- qpid/proton/trunk/docs/messenger/message_disposition.md (added) +++ qpid/proton/trunk/docs/messenger/message_disposition.md Thu Mar 14 18:29:52 2013 @@ -0,0 +1,121 @@ +Message Disposition +=== + + +Messenger disposition operations allow a receiver to accept or +reject specific messages, or ranges of messages. Senders can +detect the disposition of their messages. + + +Message States +--- + +Messages have one of four different states: + * `PN_STATUS_UNKNOWN` + * `PN_STATUS_PENDING` + * `PN_STATUS_ACCEPTED` + * `PN_STATUS_REJECTED` + + + + +Windows and Trackers + + + + + +### receiving ### + +To explicitly set or get message dispositions, your messenger +must set a positive size for its incoming window: + +pn_messenger_set_incoming_window ( messenger, N ); + +You can implicity accept messages by simply letting enough +new messages arrive. As older messages pass beyond the threshold +of your incoming window size, they will be automatically +accepted. Thus, if you want to automatically accept all +messages as they arrive, you can set your incoming window +size to 0. + +To exercise _explicit_ control over particular messages or ranges +of messages, the receiver can use trackers. The call + +pn_messenger_incoming_tracker ( messenger ); + +will return a tracker for the message most recently returned +by a call to + +pn_messenger_get ( messenger, message ); +With a message that is being tracked, the messenger can accept +(or reject) that individual message: + +pn_messenger_accept ( messenger, tracker, 0 ); +pn_messenger_reject ( messenger, tracker, 0 ); + +Or it can accept (or reject) the tracked message as well as all older +messages back to the limit of the incoming window: + +pn_messenger_accept ( messenger, tracker, PN_CUMULATIVE ); +pn_messenger_reject ( messenger, tracker, PN_CUMULATIVE ); + +Once a message is accepted or rejected, its status can no longer +be changed, even if you have a separate tracker associated with it. + + + + + + + +### sending ### + +A sender can learn how an individual message has been received +if it has a positive outgoing window size: + +pn_messenger_set_outgoing_window ( messenger, N ); + +and if a tracker has been associated with that message in question. +This call: + +pn_messenger_outgoing_tracker ( messenger ); + +will return a tracker for the message most recently given to: + +pn_messenger_put ( messenger, message ); + +To later find the status of the individual tracked message, you can call: + +pn_messenger_status ( messenger, tracker ); + +The returned value will be one of + +* `PN_STATUS_ACCEPTED` +* `PN_STATUS_REJECTED` , or +* `PN_STATUS_PENDING` - If the receiver has not disposed the message yet. + + +If either the sender or the receiver simply declares the message (or range of messages) to +be settled, with one of these calls: + +pn_messenger_settle ( messenger, tracker, 0 ); +pn_messenger_settle ( messenger, tracker, PN_CUMULATIVE ); + +then the sender will see `PN_STATUS_UNKNOWN` as the status of any +settled messages. + + + +_Note_ +If a message is rejected by the receiver, it does not mean that +the message was malformed. Malformed messages cannot be sent. +Even messages with no content are valid messages. +Rejection by a receiver should be understood as the receiver +saying "I don't want this." or possibly "I don't want this _yet_." +dependeing on your application. +The sender could decide to try sending the same message again later, +or to send the message to another receiver, or to discard it. + + + - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1455907 - in /qpid/proton/trunk/docs: messenger/ messenger/quick_start_linux.md messenger/sending_and_receiving.md quick_start_linux.markdown sending_and_receiving.markdown
Author: mgoulish Date: Wed Mar 13 12:35:51 2013 New Revision: 1455907 URL: http://svn.apache.org/r1455907 Log: Make docs/messenger dir, put docs in it, use an extension for markdown files that is less verbose, loquacious, and wordy. Added: qpid/proton/trunk/docs/messenger/ qpid/proton/trunk/docs/messenger/quick_start_linux.md qpid/proton/trunk/docs/messenger/sending_and_receiving.md Removed: qpid/proton/trunk/docs/quick_start_linux.markdown qpid/proton/trunk/docs/sending_and_receiving.markdown Added: qpid/proton/trunk/docs/messenger/quick_start_linux.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/messenger/quick_start_linux.md?rev=1455907&view=auto == --- qpid/proton/trunk/docs/messenger/quick_start_linux.md (added) +++ qpid/proton/trunk/docs/messenger/quick_start_linux.md Wed Mar 13 12:35:51 2013 @@ -0,0 +1,51 @@ +Linux Quick Start +== + + +On a Linux system, these instructions take you from +zero to running your first example code. You will +need root privileges for one of the commands. + + + + +Prerequisite Packages +- + +For a minimum build, you will need packages installed on your +box for : + +subversion +gcc +cmake +libuuid-devel + + + +Quick Start Commands +--- + +mkdir ~/proton +cd ~/proton +svn co http://svn.apache.org/repos/asf/qpid/proton/trunk +cd ./trunk +mkdir ./build +cd ./build +cmake -DCMAKE_INSTALL_PREFIX=/usr .. +make all +# Become root and go to your build dir. +make install +# Stop being root. +# Now let's see if it works. +cd ~/proton/trunk/examples/messenger/c +cmake . +make +./recv & +./send +# You're done ! +# The output you should see: + +Address: amqp://0.0.0.0 +Subject: (no subject) +Content: "Hello World!" + Added: qpid/proton/trunk/docs/messenger/sending_and_receiving.md URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/messenger/sending_and_receiving.md?rev=1455907&view=auto == --- qpid/proton/trunk/docs/messenger/sending_and_receiving.md (added) +++ qpid/proton/trunk/docs/messenger/sending_and_receiving.md Wed Mar 13 12:35:51 2013 @@ -0,0 +1,144 @@ +Sending and Receiving Messages +=== + +The Proton Messenger API provides a mixture of synchronous +and asynchronous operations to give you flexibility in +deciding when you application should block waiting for I/O, +and when it should not. + + +When sending messages, you can: + +* send a message immediately, +* enqueue a message to be sent later, +* block until all enqueued messages are sent, +* send enqueued messages until a timeout occurs, or +* send all messages that can be sent without blocking. + +When receiving messages, you can: + +* receive messages that can be received without blocking, +* block until at least one message is received, +* receive no more than a fixed number of messages. + + + +Functions +-- + +* `pn_messenger_put ( messenger )` + +Stage message for later transmission, and possibly +transmit any messages currently staged that are not +blocked. +This function will not block. + + + +* `pn_messenger_send ( messenger )` + +If messenger timeout is negative (initial default ), +block until all staged messages have been sent. + +If messenger timeout is 0, send all messages that +can be sent without blocking. + +If messenger timeout is positive, send all messages +that can be sent until timeout expires. + +_note: If there are any messages that can be received +when `pn_messenger_send()` is called, they will +be received._ + + + +* `pn_messenger_get ( messenger, msg )` + +Dequeue the head of the incoming message queue to +your application. +This call does not block. + + + +* `pn_messenger_recv ( messenger )` + +If messenger timeout is negative ( initial default ), +block until at least one message is received. + +If timeout is 0, receive whatever messages are available, +but do not block. + +If timeout is positive, receive available messages until +timeout expires. + +_note: If there are any unblocked outgoing messages, +they will be sent during this call._ + + + + + +Examples +-- + +* send a message immediately + +pn_messenger_put ( messenger, msg ); +pn_messenger_send ( messenger ); + + + +* enqueue a message to be sent later + +pn_messenger_put ( messenger, msg ); + +_note: +The message will be sent whenever it is not blocked and +the Messenger code has other I/O work to be done._ + + + +* block unti
svn commit: r1454051 - /qpid/proton/trunk/docs/quick_start_linux.markdown
Author: mgoulish Date: Thu Mar 7 19:46:52 2013 New Revision: 1454051 URL: http://svn.apache.org/r1454051 Log: initial checkin Added: qpid/proton/trunk/docs/quick_start_linux.markdown Added: qpid/proton/trunk/docs/quick_start_linux.markdown URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/quick_start_linux.markdown?rev=1454051&view=auto == --- qpid/proton/trunk/docs/quick_start_linux.markdown (added) +++ qpid/proton/trunk/docs/quick_start_linux.markdown Thu Mar 7 19:46:52 2013 @@ -0,0 +1,51 @@ +Linux Quick Start +== + + +On a Linux system, these instructions take you from +zero to running your first example code. You will +need root privileges for one of the commands. + + + + +Prerequisite Packages +- + +For a minimum build, you will need packages installed on your +box for : + +subversion +gcc +cmake +libuuid-devel + + + +Quick Start Commands +--- + +mkdir ~/proton +cd ~/proton +svn co http://svn.apache.org/repos/asf/qpid/proton/trunk +cd ./trunk +mkdir ./build +cd ./build +cmake -DCMAKE_INSTALL_PREFIX=/usr .. +make all +# Become root and go to your build dir. +make install +# Stop being root. +# Now let's see if it works. +cd ~/proton/trunk/examples/messenger/c +cmake . +make +./recv & +./send +# You're done ! +# The output you should see: + +Address: amqp://0.0.0.0 +Subject: (no subject) +Content: "Hello World!" + - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1453966 - in /qpid/proton/trunk/docs: ./ sending_and_receiving.markdown
Author: mgoulish Date: Thu Mar 7 17:15:49 2013 New Revision: 1453966 URL: http://svn.apache.org/r1453966 Log: Initial checkin. Added: qpid/proton/trunk/docs/ qpid/proton/trunk/docs/sending_and_receiving.markdown Added: qpid/proton/trunk/docs/sending_and_receiving.markdown URL: http://svn.apache.org/viewvc/qpid/proton/trunk/docs/sending_and_receiving.markdown?rev=1453966&view=auto == --- qpid/proton/trunk/docs/sending_and_receiving.markdown (added) +++ qpid/proton/trunk/docs/sending_and_receiving.markdown Thu Mar 7 17:15:49 2013 @@ -0,0 +1,144 @@ +Sending and Receiving Messages +=== + +The Proton Messenger API provides a mixture of synchronous +and asynchronous operations to give you flexibility in +deciding when you application should block waiting for I/O, +and when it should not. + + +When sending messages, you can: + +* send a message immediately, +* enqueue a message to be sent later, +* block until all enqueued messages are sent, +* send enqueued messages until a timeout occurs, or +* send all messages that can be sent without blocking. + +When receiving messages, you can: + +* receive messages that can be received without blocking, +* block until at least one message is received, +* receive no more than a fixed number of messages. + + + +Functions +-- + +* `pn_messenger_put ( messenger )` + +Stage message for later transmission, and possibly +transmit any messages currently staged that are not +blocked. +This function will not block. + + + +* `pn_messenger_send ( messenger )` + +If messenger timeout is negative (initial default ), +block until all staged messages have been sent. + +If messenger timeout is 0, send all messages that +can be sent without blocking. + +If messenger timeout is positive, send all messages +that can be sent until timeout expires. + +_note: If there are any messages that can be received +when `pn_messenger_send()` is called, they will +be received._ + + + +* `pn_messenger_get ( messenger, msg )` + +Dequeue the head of the incoming message queue to +your application. +This call does not block. + + + +* `pn_messenger_recv ( messenger )` + +If messenger timeout is negative ( initial default ), +block until at least one message is received. + +If timeout is 0, receive whatever messages are available, +but do not block. + +If timeout is positive, receive available messages until +timeout expires. + +_note: If there are any unblocked outgoing messages, +they will be sent during this call._ + + + + + +Examples +-- + +* send a message immediately + +pn_messenger_put ( messenger, msg ); +pn_messenger_send ( messenger ); + + + +* enqueue a message to be sent later + +pn_messenger_put ( messenger, msg ); + +_note: +The message will be sent whenever it is not blocked and +the Messenger code has other I/O work to be done._ + + + +* block until all enqueued messages are sent + +pn_messenger_set_timeout ( messenger, -1 ); +pn_messenger_send ( messenger ); + +_note: +A negative timeout means 'forever'. That is the initial +default for a messenger._ + + + +* send enqueued messages until a timeout occurs + +pn_messenger_set_timeout ( messenger, 100 ); /* 100 msec */ +pn_messenger_send ( messenger ); + + + +* send all messages that can be sent without blocking + +pn_messenger_set_timeout ( messenger, 0 ); +pn_messenger_send ( messenger ); + + + +* receive messages that can be received without blocking + +pn_messenger_set_timeout ( messenger, 0 ); +pn_messenger_recv ( messenger, -1 ); + + +* block until at least one message is received + +pn_messenger_set_timeout ( messenger, -1 ); +pn_messenger_recv ( messenger, -1 ); + +_note: -1 is initial messenger default._ + + + +* receive no more than a fixed number of messages + +pn_messenger_recv ( messenger, 10 ); + - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1431548 - /qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp
Author: mgoulish Date: Thu Jan 10 18:35:15 2013 New Revision: 1431548 URL: http://svn.apache.org/viewvc?rev=1431548&view=rev Log: QPID-4531 : older GCC libs have error on negative-zero cast. This is a real fix, a replacement for r1431435, which was written by a crazy person. Modified: qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp?rev=1431548&r1=1431547&r2=1431548&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp Thu Jan 10 18:35:15 2013 @@ -110,22 +110,28 @@ class VariantImpl } value; std::string encoding;//optional encoding for variable length data -template T convertFromString() const + template T convertFromString() const { const std::string& s = *value.string; try { -T r = boost::lexical_cast(s); -//lexical_cast won't fail if string is a negative number and T is unsigned -//So check that and allow special case of negative zero -//else its a non-zero negative number so throw exception at end of function -if (std::numeric_limits::is_signed || s.find('-') != 0 || r == 0) { -return r; +// Extra shenanigans to work around negative zero +// conversion error in older GCC libs. +if ( s[0] != '-' ) { +return boost::lexical_cast(s); +} else { +T r = boost::lexical_cast(s.substr(1)); +if (std::numeric_limits::is_signed) { +return -r; +} else { +if (r==0) return 0; +} } } catch(const boost::bad_lexical_cast&) { } throw InvalidConversion(QPID_MSG("Cannot convert " << s)); } + }; - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1431509 - /qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp
Author: mgoulish Date: Thu Jan 10 17:26:13 2013 New Revision: 1431509 URL: http://svn.apache.org/viewvc?rev=1431509&view=rev Log: NO-JIRA : undoing r1431435. It's wrong, wrong, wrong! Modified: qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp?rev=1431509&r1=1431508&r2=1431509&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp Thu Jan 10 17:26:13 2013 @@ -114,15 +114,6 @@ class VariantImpl { const std::string& s = *value.string; -// The lexical cast below is throwing when the type -// is signed and the value is negative-zero. Bug, I guess. -// So short-circuit it here. Negative zero is zero. -double dbl_val = atof ( s.c_str() ); -if ( ( dbl_val == 0 ) && ( 0 == s.find('-') ) ) { -T r = 0; -return r; -} - try { T r = boost::lexical_cast(s); //lexical_cast won't fail if string is a negative number and T is unsigned - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1431435 - /qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp
Author: mgoulish Date: Thu Jan 10 15:36:02 2013 New Revision: 1431435 URL: http://svn.apache.org/viewvc?rev=1431435&view=rev Log: JIRA-4531 : Variant.cpp cast of -0 failing with older GCC Modified: qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp?rev=1431435&r1=1431434&r2=1431435&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/types/Variant.cpp Thu Jan 10 15:36:02 2013 @@ -113,6 +113,16 @@ class VariantImpl template T convertFromString() const { const std::string& s = *value.string; + +// The lexical cast below is throwing when the type +// is signed and the value is negative-zero. Bug, I guess. +// So short-circuit it here. Negative zero is zero. +double dbl_val = atof ( s.c_str() ); +if ( ( dbl_val == 0 ) && ( 0 == s.find('-') ) ) { +T r = 0; +return r; +} + try { T r = boost::lexical_cast(s); //lexical_cast won't fail if string is a negative number and T is unsigned - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1431016 - in /qpid/trunk/qpid/cpp/src: qpid/Options.cpp qpidd.cpp
Author: mgoulish Date: Wed Jan 9 19:23:36 2013 New Revision: 1431016 URL: http://svn.apache.org/viewvc?rev=1431016&view=rev Log: QPID-4518 : disallow unknown args in config file Change EnvOptMapper::configFileLine to take ar arg telling it if it's OK to have unknown args or not. If not, throw upon encountering. >From the higher level of run_broker(), there are two passes of arg parsing. In the first pass it's normal to have unknown args, because the loadable modules are not loaded yet. But I change the second parsing to pass down the arg that says "unknowns are not okay." Modified: qpid/trunk/qpid/cpp/src/qpid/Options.cpp qpid/trunk/qpid/cpp/src/qpidd.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/Options.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/Options.cpp?rev=1431016&r1=1431015&r2=1431016&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/Options.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/Options.cpp Wed Jan 9 19:23:36 2013 @@ -74,14 +74,28 @@ struct EnvOptMapper { } -string configFileLine (string& line) { +void badArg ( string& line ) { +ostringstream msg; +msg << "Bad argument: |" << line << "|\n"; +throw Exception(msg.str()); +} -if ( isComment ( line ) ) - return string(); -size_t pos = line.find ('='); -if (pos == string::npos) +string configFileLine (string& line, bool allowUnknowns=true) { + +if ( isComment ( line ) ) { return string(); +} + +size_t pos = line.find ('='); +if (pos == string::npos) { +if ( allowUnknowns ) { +return string(); +} +else { +badArg ( line ); +} +} string key = line.substr (0, pos); #if (BOOST_VERSION >= 103300) typedef const std::vector< boost::shared_ptr > OptDescs; @@ -89,16 +103,31 @@ struct EnvOptMapper { find_if(opts.options().begin(), opts.options().end(), boost::bind(matchCase, key, _1)); if (i != opts.options().end()) return string (line) + "\n"; -else - return string(); +else { +if ( allowUnknowns ) { +return string(); +} +else { +badArg ( line ); +} +} #else -// Use 'count' to see if this option exists. Using 'find' will SEGV or hang -// if the option has not been defined yet. +// Use 'count' to see if this option exists. Using 'find' will +// SEGV or hang if the option has not been defined yet. if ( opts.count(key.c_str()) > 0 ) return string ( line ) + "\n"; -else - return string ( ); +else { +if ( allowUnknowns ) { +return string ( ); +} +else { +badArg ( line ); +} +} #endif + // Control will not arrive here, but the compiler things it could. + // Calls to badArg(), that I used above, throw. + return string(); } const Options& opts; @@ -160,7 +189,7 @@ void Options::parse(int argc, char const while (!conf.eof()) { string line; getline (conf, line); -filtered << mapper.configFileLine (line); +filtered << mapper.configFileLine (line, allowUnknown); } po::store(po::parse_config_file(filtered, *this), vm); Modified: qpid/trunk/qpid/cpp/src/qpidd.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpidd.cpp?rev=1431016&r1=1431015&r2=1431016&view=diff == --- qpid/trunk/qpid/cpp/src/qpidd.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpidd.cpp Wed Jan 9 19:23:36 2013 @@ -82,10 +82,12 @@ int run_broker(int argc, char *argv[], b qpid::loadModuleDir (bootOptions.module.loadDir, isDefault); } -// Parse options +// Parse options. In the second pass, do not allow unknown options. +// All the modules have been added now, so any unknown options +// should be flagged as errors. try { options.reset(new QpiddOptions(argv[0])); -options->parse(argc, argv, options->common.config); +options->parse(argc, argv, options->common.config, false); } catch (const std::exception& /*e*/) { if (helpArgSeen) { // provide help even when parsing fails - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1387135 - in /qpid/trunk/qpid/cpp/src: qpid/broker/QueueSettings.cpp tests/MessagingSessionTests.cpp
Author: mgoulish Date: Tue Sep 18 13:10:04 2012 New Revision: 1387135 URL: http://svn.apache.org/viewvc?rev=1387135&view=rev Log: qpid-4317 make browse-only x-arg string similar to others Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp?rev=1387135&r1=1387134&r2=1387135&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp Tue Sep 18 13:10:04 2012 @@ -39,7 +39,7 @@ const std::string POLICY_TYPE("qpid.poli const std::string POLICY_TYPE_REJECT("reject"); const std::string POLICY_TYPE_RING("ring"); const std::string NO_LOCAL("no-local"); -const std::string BROWSE_ONLY("browse-only"); +const std::string BROWSE_ONLY("qpid.browse-only"); const std::string TRACE_ID("qpid.trace.id"); const std::string TRACE_EXCLUDES("qpid.trace.exclude"); const std::string LVQ_KEY("qpid.last_value_queue_key"); Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=1387135&r1=1387134&r2=1387135&view=diff == --- qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp (original) +++ qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Tue Sep 18 13:10:04 2012 @@ -1172,7 +1172,7 @@ QPID_AUTO_TEST_CASE(testBrowseOnly) allow message acquisition. */ QueueFixture fix; -std::string addr = "q; {create:always, node:{type:queue, durable:false, x-declare:{arguments:{browse-only:1"; +std::string addr = "q; {create:always, node:{type:queue, durable:false, x-declare:{arguments:{qpid.browse-only:1"; Sender sender = fix.session.createSender(addr); Message out("test-message"); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1384851 - /qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp
Author: mgoulish Date: Fri Sep 14 17:11:09 2012 New Revision: 1384851 URL: http://svn.apache.org/viewvc?rev=1384851&view=rev Log: Jira QPID-4142 auto test for browse-only queues - using messaging interface Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=1384851&r1=1384850&r2=1384851&view=diff == --- qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp (original) +++ qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Fri Sep 14 17:11:09 2012 @@ -1164,6 +1164,38 @@ QPID_AUTO_TEST_CASE(testAlternateExchang } } +QPID_AUTO_TEST_CASE(testBrowseOnly) +{ +/* Set up a queue browse-only, and try to receive + the same messages twice with two different receivers. + This works because the browse-only queue does not + allow message acquisition. */ + +QueueFixture fix; +std::string addr = "q; {create:always, node:{type:queue, durable:false, x-declare:{arguments:{browse-only:1"; +Sender sender = fix.session.createSender(addr); +Message out("test-message"); + +int count = 10; +for ( int i = 0; i < count; ++ i ) { +sender.send(out); +} + +Message m; + +Receiver receiver_1 = fix.session.createReceiver(addr); +for ( int i = 0; i < count; ++ i ) { + BOOST_CHECK(receiver_1.fetch(m, Duration::SECOND)); +} + +Receiver receiver_2 = fix.session.createReceiver(addr); +for ( int i = 0; i < count; ++ i ) { + BOOST_CHECK(receiver_2.fetch(m, Duration::SECOND)); +} + +fix.session.acknowledge(); +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1382991 - in /qpid/trunk/qpid/cpp/src/qpid/broker: Queue.cpp QueueSettings.cpp QueueSettings.h SessionAdapter.cpp
Author: mgoulish Date: Mon Sep 10 17:23:34 2012 New Revision: 1382991 URL: http://svn.apache.org/viewvc?rev=1382991&view=rev Log: Jira QPID-4142 browse-only queues Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1382991&r1=1382990&r2=1382991&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Mon Sep 10 17:23:34 2012 @@ -206,6 +206,10 @@ Queue::Queue(const string& _name, const brokerMgmtObject->inc_queueCount(); } } + +if ( settings.isBrowseOnly ) { +QPID_LOG ( info, "Queue " << name << " is browse-only." ); +} } Queue::~Queue() @@ -483,6 +487,11 @@ void Queue::consume(Consumer::shared_ptr // Check for exclusivity of acquiring consumers. size_t acquiringConsumers = consumerCount - browserCount; if (c->preAcquires()) { +if(settings.isBrowseOnly) { +throw NotAllowedException( +QPID_MSG("Queue " << name << " is browse only. Refusing acquiring consumer.")); +} + if(exclusive) { throw ResourceLockedException( QPID_MSG("Queue " << getName() Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp?rev=1382991&r1=1382990&r2=1382991&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.cpp Mon Sep 10 17:23:34 2012 @@ -39,6 +39,7 @@ const std::string POLICY_TYPE("qpid.poli const std::string POLICY_TYPE_REJECT("reject"); const std::string POLICY_TYPE_RING("ring"); const std::string NO_LOCAL("no-local"); +const std::string BROWSE_ONLY("browse-only"); const std::string TRACE_ID("qpid.trace.id"); const std::string TRACE_EXCLUDES("qpid.trace.exclude"); const std::string LVQ_KEY("qpid.last_value_queue_key"); @@ -82,6 +83,7 @@ QueueSettings::QueueSettings(bool d, boo addTimestamp(false), dropMessagesAtLimit(false), noLocal(false), +isBrowseOnly(false), autoDeleteDelay(0), alertRepeatInterval(60) {} @@ -108,6 +110,9 @@ bool QueueSettings::handle(const std::st } else if (key == NO_LOCAL) { noLocal = value; return true; +} else if (key == BROWSE_ONLY) { +isBrowseOnly = value; +return true; } else if (key == TRACE_ID) { traceId = value.asString(); return true; Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h?rev=1382991&r1=1382990&r2=1382991&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/QueueSettings.h Mon Sep 10 17:23:34 2012 @@ -59,6 +59,7 @@ struct QueueSettings bool dropMessagesAtLimit;//aka ring queue policy bool noLocal; +bool isBrowseOnly; std::string traceId; std::string traceExcludes; uint64_t autoDeleteDelay;//queueTtl? Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp?rev=1382991&r1=1382990&r2=1382991&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp Mon Sep 10 17:23:34 2012 @@ -422,6 +422,11 @@ SessionAdapter::MessageHandlerImpl::subs if(!destination.empty() && state.exists(destination)) throw NotAllowedException(QPID_MSG("Consumer tags must be unique")); +if (queue->getSettings().isBrowseOnly && acquireMode == 0) { +QPID_LOG(info, "Overriding request to consume from browse-only queue " << queue->getName()); +acquireMode = 1; +} + // We allow browsing (acquireMode == 1) of exclusive queues, this is required by HA. if (queue->hasExclusiveOwner() && !queue->isExclusiveOwner(&session) && acquireMode == 0) throw ResourceLockedException(QPID_MSG("Cannot subscribe to exclusive queue " - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1376958 - /qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf
Author: mgoulish Date: Fri Aug 24 15:22:04 2012 New Revision: 1376958 URL: http://svn.apache.org/viewvc?rev=1376958&view=rev Log: QPID-4244 : expand broker mech list in sasl config file. in The file /etc/sasl2/qpidd.conf, expand the list to: ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN and improve the comments. Modified: qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf Modified: qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf?rev=1376958&r1=1376957&r2=1376958&view=diff == --- qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf (original) +++ qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf Fri Aug 24 15:22:04 2012 @@ -18,33 +18,31 @@ # # #- -# Mechanisms and Users +# SASL Mechanisms and Users #- # -# This default qpidd configuration allows for only SASL ANONYMOUS authentication. -# To additionally enable DIGEST-MD5 authentication: -# -# 1. edit the mech_list below to read -# mech_list: DIGEST-MD5 ANONYMOUS -# -# 2. To add new a new user+password to the sasldb file: -# echo $PASSWD | saslpasswd2 -c -p -f $SASLTEST_DB -u QPID $USERNAME -# +# This default mech list allows for PLAIN, but that +# mechanism sends credentials in the clear, and is normally +# only used along with SSL transport-layer security. +# +# This default also permits DIGEST-MD5, but you must have +# a user and password defined in your sasldb file to use +# this mechanism.( See notes below. ) # # PLEASE NOTE # For production messaging systems, a high-security mechanism such as -# DIGEST-MD5 or PLAIN+SSL should be enabled. +# DIGEST-MD5 or PLAIN+SSL should be used. # # pwcheck_method: auxprop auxprop_plugin: sasldb sasldb_path: /var/lib/qpidd/qpidd.sasldb -mech_list: ANONYMOUS +mech_list: ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN #- -# Other Notes +# Please Note #- # # 1. If you use a nonstandard location for your sasl_config directory, @@ -60,15 +58,19 @@ mech_list: ANONYMOUS # /var/lib/qpidd/qpidd.sasldb # # 3. You can see what usernames have been stored in the sasldb, with the -#sasldblistusers2 command. +#command "sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb" # # 4. The REALM is important and should be the same as the --realm #option to the broker. This lets the broker properly find the user in #the sasldb file. # # 5. The sasldb file must be readable by the user running the qpidd -#daemon, and should be readable only by that user. +#daemon, ( the user name is qpidd ) and should be readable only +#by that user. # +# 6. The EXTERNAL mechanism allows you to use SSL transport layer +#security. In that case, you can also set the broker option +#--ssl-require-client-authentication . - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1373004 - /qpid/branches/0.18/qpid/cpp/src/qpid/cluster/Cluster.cpp
Author: mgoulish Date: Tue Aug 14 18:20:05 2012 New Revision: 1373004 URL: http://svn.apache.org/viewvc?rev=1373004&view=rev Log: QPID-4194 : re-enable queue events in CATCHUP state. pavel moravec's fix -- without this, newbie broker with a replication queue will not replicate messages received during CATCHUP. Modified: qpid/branches/0.18/qpid/cpp/src/qpid/cluster/Cluster.cpp Modified: qpid/branches/0.18/qpid/cpp/src/qpid/cluster/Cluster.cpp URL: http://svn.apache.org/viewvc/qpid/branches/0.18/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=1373004&r1=1373003&r2=1373004&view=diff == --- qpid/branches/0.18/qpid/cpp/src/qpid/cluster/Cluster.cpp (original) +++ qpid/branches/0.18/qpid/cpp/src/qpid/cluster/Cluster.cpp Tue Aug 14 18:20:05 2012 @@ -615,7 +615,6 @@ void Cluster::configChange ( void Cluster::setReady(Lock&) { state = READY; mcast.setReady(); -broker.getQueueEvents().enable(); enableClusterSafe();// Enable cluster-safe assertions. } @@ -979,6 +978,12 @@ void Cluster::checkUpdateIn(Lock& l) { map = *updatedMap; mcast.mcastControl(ClusterReadyBody(ProtocolVersion(), myUrl.str()), self); state = CATCHUP; +/* In CATCHUP mode the update has finished, and we are consuming +** whatever backlog of messages has built up during the update. +** We should enable queue events here, or messages that are received +** during this phase will not be replicated properly. ( If there are +** relevant replication queues. ) */ +broker.getQueueEvents().enable(); memberUpdate(l); // Must be called *after* memberUpdate() to avoid sending an extra update. failoverExchange->setReady(); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1369960 - /qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
Author: mgoulish Date: Mon Aug 6 20:04:58 2012 New Revision: 1369960 URL: http://svn.apache.org/viewvc?rev=1369960&view=rev Log: QPID-4194 : re-enable queue events in CATCHUP state pavel moravec's fix -- without this, newbie broker with a replication queue will not replicate messages received during CATCHUP. Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=1369960&r1=1369959&r2=1369960&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Mon Aug 6 20:04:58 2012 @@ -615,7 +615,6 @@ void Cluster::configChange ( void Cluster::setReady(Lock&) { state = READY; mcast.setReady(); -broker.getQueueEvents().enable(); enableClusterSafe();// Enable cluster-safe assertions. } @@ -979,6 +978,13 @@ void Cluster::checkUpdateIn(Lock& l) { map = *updatedMap; mcast.mcastControl(ClusterReadyBody(ProtocolVersion(), myUrl.str()), self); state = CATCHUP; +/* In CATCHUP mode the update has finished, and we are consuming +** whatever backlog of messages has built up during the update. +** We should enable queue events here, or messages that are received +** during this phase will not be replicated properly. ( If there are +** relevant replication queues. ) +*/ +broker.getQueueEvents().enable(); memberUpdate(l); // Must be called *after* memberUpdate() to avoid sending an extra update. failoverExchange->setReady(); - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1364648 - /qpid/trunk/qpid/cpp/src/tests/cluster_test_logs.py
Author: mgoulish Date: Mon Jul 23 14:29:19 2012 New Revision: 1364648 URL: http://svn.apache.org/viewvc?rev=1364648&view=rev Log: NO-JIRA: fix spurious diff when comparing cluster log files. Modified: qpid/trunk/qpid/cpp/src/tests/cluster_test_logs.py Modified: qpid/trunk/qpid/cpp/src/tests/cluster_test_logs.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/cluster_test_logs.py?rev=1364648&r1=1364647&r2=1364648&view=diff == --- qpid/trunk/qpid/cpp/src/tests/cluster_test_logs.py (original) +++ qpid/trunk/qpid/cpp/src/tests/cluster_test_logs.py Mon Jul 23 14:29:19 2012 @@ -66,7 +66,8 @@ def filter_log(log): 'debug Sending keepalive signal to watchdog', # Watchdog timer thread 'last broker standing joined by 1 replicas, updating queue policies.', 'Connection .* timed out: closing', # heartbeat connection close -"org.apache.qpid.broker:bridge:" # ignore bridge index +"org.apache.qpid.broker:bridge:", # ignore bridge index +"closed connection" ]) # Regex to match a UUID uuid='\w\w\w\w\w\w\w\w-\w\w\w\w-\w\w\w\w-\w\w\w\w-\w\w\w\w\w\w\w\w\w\w\w\w' - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1311962 - /qpid/branches/0.16/qpid/extras/qmf/src/py/qmf/console.py
Author: mgoulish Date: Tue Apr 10 20:03:01 2012 New Revision: 1311962 URL: http://svn.apache.org/viewvc?rev=1311962&view=rev Log: QPID-3919 qpid-printevents backtrace under python 2.4 and 2.6 Modified: qpid/branches/0.16/qpid/extras/qmf/src/py/qmf/console.py Modified: qpid/branches/0.16/qpid/extras/qmf/src/py/qmf/console.py URL: http://svn.apache.org/viewvc/qpid/branches/0.16/qpid/extras/qmf/src/py/qmf/console.py?rev=1311962&r1=1311961&r2=1311962&view=diff == --- qpid/branches/0.16/qpid/extras/qmf/src/py/qmf/console.py (original) +++ qpid/branches/0.16/qpid/extras/qmf/src/py/qmf/console.py Tue Apr 10 20:03:01 2012 @@ -3948,7 +3948,7 @@ class Event: return "" out = strftime("%c", gmtime(self.timestamp / 10)) out += " " + self._sevName() + " " + self.classKey.getPackageName() + ":" + self.classKey.getClassName() -out += " broker=" + self.broker.getUrl() +out += " broker=" + str(self.broker.getUrl()) for arg in self.schema.arguments: disp = self.session._displayValue(self.arguments[arg.name], arg.type).encode("utf8") if " " in disp: - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1305998 - /qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py
Author: mgoulish Date: Tue Mar 27 20:05:11 2012 New Revision: 1305998 URL: http://svn.apache.org/viewvc?rev=1305998&view=rev Log: QPID-3919 qpid-printevents was not able to connect. Modified: qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py Modified: qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py?rev=1305998&r1=1305997&r2=1305998&view=diff == --- qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py (original) +++ qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py Tue Mar 27 20:05:11 2012 @@ -3948,7 +3948,7 @@ class Event: return "" out = strftime("%c", gmtime(self.timestamp / 10)) out += " " + self._sevName() + " " + self.classKey.getPackageName() + ":" + self.classKey.getClassName() -out += " broker=" + self.broker.getUrl() +out += " broker=" + str(self.broker.getUrl()) for arg in self.schema.arguments: disp = self.session._displayValue(self.arguments[arg.name], arg.type).encode("utf8") if " " in disp: - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1301153 - /qpid/trunk/qpid/cpp/src/tests/ssl_test
Author: mgoulish Date: Thu Mar 15 19:06:09 2012 New Revision: 1301153 URL: http://svn.apache.org/viewvc?rev=1301153&view=rev Log: NO-JIRA use new local sasl config file when starting authenticating broker, so that sasl mechs will not depend on the whimsies and vicissitudes of the system settings. Modified: qpid/trunk/qpid/cpp/src/tests/ssl_test Modified: qpid/trunk/qpid/cpp/src/tests/ssl_test URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ssl_test?rev=1301153&r1=1301152&r2=1301153&view=diff == --- qpid/trunk/qpid/cpp/src/tests/ssl_test (original) +++ qpid/trunk/qpid/cpp/src/tests/ssl_test Thu Mar 15 19:06:09 2012 @@ -100,8 +100,10 @@ start_ssl_mux_broker() { PORTS=( ${PORTS[@]} $1 ) } +sasl_config_dir=$builddir/sasl_config + start_authenticating_broker() { -start_brokers 1 "--transport ssl --ssl-port 0 --require-encryption --ssl-sasl-no-dict --ssl-require-client-authentication --auth yes" +start_brokers 1 "--transport ssl --ssl-port 0 --require-encryption --ssl-sasl-no-dict --ssl-require-client-authentication --auth yes --sasl-config=${sasl_config_dir}" } ssl_cluster_broker() { # $1 = port - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1300562 - /qpid/trunk/qpid/python/qpid/connection.py
Author: mgoulish Date: Wed Mar 14 14:33:28 2012 New Revision: 1300562 URL: http://svn.apache.org/viewvc?rev=1300562&view=rev Log: QPID-3898 When connecting through SSL, qpid-tool starts disconnecting and reconnecting every 10 seconds. The connection it makes is good -- it gets real data. But then it unilaterally decides to disconnect, immediately reconnects -- and cycles this way forever. Well -- until you stop it, anyway. qpid-stat does not do this. This is similar to a problem that was fixed long ago in the original code -- but that was written before SSL support was available in Python. Modified: qpid/trunk/qpid/python/qpid/connection.py Modified: qpid/trunk/qpid/python/qpid/connection.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/connection.py?rev=1300562&r1=1300561&r2=1300562&view=diff == --- qpid/trunk/qpid/python/qpid/connection.py (original) +++ qpid/trunk/qpid/python/qpid/connection.py Wed Mar 14 14:33:28 2012 @@ -170,6 +170,10 @@ class Connection(Framer): if not status: self.detach_all() break + # When we do not use SSL transport, we get periodic + # spurious timeout events on the socket. When using SSL, + # these events show up as timeout *errors*. Both should be + # ignored unless we have aborted. except socket.timeout: if self.aborted(): self.close_code = (None, "connection timed out") @@ -178,9 +182,12 @@ class Connection(Framer): else: continue except socket.error, e: -self.close_code = (None, str(e)) -self.detach_all() -break +if self.aborted() or str(e) != "The read operation timed out": + self.close_code = (None, str(e)) + self.detach_all() + break +else: + continue frame_dec.write(data) seg_dec.write(*frame_dec.read()) op_dec.write(*seg_dec.read()) - To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org
svn commit: r1236729 - /qpid/trunk/qpid/python/qpid/connection.py
Author: mgoulish Date: Fri Jan 27 16:18:01 2012 New Revision: 1236729 URL: http://svn.apache.org/viewvc?rev=1236729&view=rev Log: qpid-3778 fix for previous fix. This one doesn't break qpid.tests.connection.ConnectionTest.testCloseGet and qpid.tests.connection.ConnectionTest.testCloseListen Modified: qpid/trunk/qpid/python/qpid/connection.py Modified: qpid/trunk/qpid/python/qpid/connection.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/connection.py?rev=1236729&r1=1236728&r2=1236729&view=diff == --- qpid/trunk/qpid/python/qpid/connection.py (original) +++ qpid/trunk/qpid/python/qpid/connection.py Fri Jan 27 16:18:01 2012 @@ -27,6 +27,7 @@ from generator import control_invoker from exceptions import * from logging import getLogger import delegates, socket +import sys class ChannelBusy(Exception): pass @@ -159,11 +160,16 @@ class Connection(Framer): while not self.closed: try: data = self.sock.recv(64*1024) -if self.security_layer_rx and data: - status, data = self.security_layer_rx.decode(data) if not data: self.detach_all() break +# If we have a security layer and it sends us no decoded data, +# that's OK as long as its return code is happy. +if self.security_layer_rx: + status, data = self.security_layer_rx.decode(data) + if not status: +self.detach_all() +break except socket.timeout: if self.aborted(): self.close_code = (None, "connection timed out") - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1235906 - /qpid/trunk/qpid/python/qpid/connection.py
Author: mgoulish Date: Wed Jan 25 20:20:28 2012 New Revision: 1235906 URL: http://svn.apache.org/viewvc?rev=1235906&view=rev Log: Backing out change from rev 1235255. This change broke these two tests: qpid.tests.connection.ConnectionTest.testCloseGet qpid.tests.connection.ConnectionTest.testCloseListen Modified: qpid/trunk/qpid/python/qpid/connection.py Modified: qpid/trunk/qpid/python/qpid/connection.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/connection.py?rev=1235906&r1=1235905&r2=1235906&view=diff == --- qpid/trunk/qpid/python/qpid/connection.py (original) +++ qpid/trunk/qpid/python/qpid/connection.py Wed Jan 25 20:20:28 2012 @@ -161,12 +161,9 @@ class Connection(Framer): data = self.sock.recv(64*1024) if self.security_layer_rx and data: status, data = self.security_layer_rx.decode(data) - # zero-length data is OK, as long as return code is good. - # when that happens, just keep trying. the sasl library - # will send us data eventually. ( or an error code. ) - if not status: -self.detach_all() -break +if not data: + self.detach_all() + break except socket.timeout: if self.aborted(): self.close_code = (None, "connection timed out") - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1235255 - /qpid/trunk/qpid/python/qpid/connection.py
Author: mgoulish Date: Tue Jan 24 14:06:06 2012 New Revision: 1235255 URL: http://svn.apache.org/viewvc?rev=1235255&view=rev Log: qpid-3778 see comment in code. this was causing a "connection aborted" failure when qpid-stat was connected through MD5, and there were several qpid-tools also connected, not in any special way, and not doing anything. Modified: qpid/trunk/qpid/python/qpid/connection.py Modified: qpid/trunk/qpid/python/qpid/connection.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/connection.py?rev=1235255&r1=1235254&r2=1235255&view=diff == --- qpid/trunk/qpid/python/qpid/connection.py (original) +++ qpid/trunk/qpid/python/qpid/connection.py Tue Jan 24 14:06:06 2012 @@ -161,9 +161,12 @@ class Connection(Framer): data = self.sock.recv(64*1024) if self.security_layer_rx and data: status, data = self.security_layer_rx.decode(data) -if not data: - self.detach_all() - break + # zero-length data is OK, as long as return code is good. + # when that happens, just keep trying. the sasl library + # will send us data eventually. ( or an error code. ) + if not status: +self.detach_all() +break except socket.timeout: if self.aborted(): self.close_code = (None, "connection timed out") - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1227616 - in /qpid/trunk/qpid/cpp/src/qpid: broker/Connection.cpp broker/Connection.h broker/SaslAuthenticator.cpp cluster/Connection.cpp
Author: mgoulish Date: Thu Jan 5 14:56:52 2012 New Revision: 1227616 URL: http://svn.apache.org/viewvc?rev=1227616&view=rev Log: QPID-3438 Remove unnecessary changes to broker. The cluster code does not really need to know that the cnx error was due to auth failure. Any failure before the cnx has opened should cause the cnx to be removed from the 'local' map, or a cnx leak will occur. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp?rev=1227616&r1=1227615&r2=1227616&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp Thu Jan 5 14:56:52 2012 @@ -100,8 +100,7 @@ Connection::Connection(ConnectionOutputH errorListener(0), objectId(objectId_), shadow(shadow_), -outboundTracker(*this), -securityFailed(false) +outboundTracker(*this) { outboundTracker.wrap(out); if (isLink) Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h?rev=1227616&r1=1227615&r2=1227616&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h Thu Jan 5 14:56:52 2012 @@ -207,13 +207,8 @@ class Connection : public sys::Connectio void sent(const framing::AMQFrame& f); -bool securityFailed; - public: -bool securityFailure ( ) const { return securityFailed; } -void securityFailure ( bool failed ) { securityFailed = failed; } - qmf::org::apache::qpid::broker::Connection* getMgmtObject() { return mgmtObject; } }; Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp?rev=1227616&r1=1227615&r2=1227616&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Thu Jan 5 14:56:52 2012 @@ -450,7 +450,6 @@ void CyrusAuthenticator::processAuthenti client.secure(challenge_str); } else { -connection.securityFailure ( true ); std::string uid; //save error detail before trying to retrieve username as error in doing so will overwrite it std::string errordetail = sasl_errdetail(sasl_conn); Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp?rev=1227616&r1=1227615&r2=1227616&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Thu Jan 5 14:56:52 2012 @@ -742,9 +742,7 @@ void Connection::connectionError(const s cluster.flagError(*this, ERROR_TYPE_CONNECTION, msg); } else -if ( connection->securityFailure() ) { cluster.eraseLocal(self); -} } void Connection::addQueueListener(const std::string& q, uint32_t listener) { - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1215127 - in /qpid/trunk/qpid/cpp/src/qpid: broker/Connection.cpp broker/Connection.h broker/SaslAuthenticator.cpp cluster/Cluster.cpp cluster/Cluster.h cluster/Connection.cpp
Author: mgoulish Date: Fri Dec 16 13:40:58 2011 New Revision: 1215127 URL: http://svn.apache.org/viewvc?rev=1215127&view=rev Log: QPID-3438 fix cluster causing cnx leak when bad credentials are given in login attempt. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp?rev=1215127&r1=1215126&r2=1215127&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp Fri Dec 16 13:40:58 2011 @@ -100,7 +100,8 @@ Connection::Connection(ConnectionOutputH errorListener(0), objectId(objectId_), shadow(shadow_), -outboundTracker(*this) +outboundTracker(*this), +securityFailed(false) { outboundTracker.wrap(out); if (isLink) Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h?rev=1215127&r1=1215126&r2=1215127&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Connection.h Fri Dec 16 13:40:58 2011 @@ -205,9 +205,15 @@ class Connection : public sys::Connectio }; OutboundFrameTracker outboundTracker; - void sent(const framing::AMQFrame& f); + +bool securityFailed; + public: + +bool securityFailure ( ) const { return securityFailed; } +void securityFailure ( bool failed ) { securityFailed = failed; } + qmf::org::apache::qpid::broker::Connection* getMgmtObject() { return mgmtObject; } }; Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp?rev=1215127&r1=1215126&r2=1215127&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Fri Dec 16 13:40:58 2011 @@ -450,6 +450,7 @@ void CyrusAuthenticator::processAuthenti client.secure(challenge_str); } else { +connection.securityFailure ( true ); std::string uid; //save error detail before trying to retrieve username as error in doing so will overwrite it std::string errordetail = sasl_errdetail(sasl_conn); Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=1215127&r1=1215126&r2=1215127&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Fri Dec 16 13:40:58 2011 @@ -383,12 +383,21 @@ void Cluster::erase(const ConnectionId& erase(id,l); } +void Cluster::eraseLocal(const ConnectionId& id) { +Lock l(lock); +eraseLocal(id,l); +} + // Called by Connection::deliverClose() in deliverFrameQueue thread. void Cluster::erase(const ConnectionId& id, Lock&) { connections.erase(id); decoder.erase(id); } +void Cluster::eraseLocal(const ConnectionId& id, Lock&) { +localConnections.getErase(id); +} + std::vector Cluster::getIds() const { Lock l(lock); return getIds(l); Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h?rev=1215127&r1=1215126&r2=1215127&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h (original) +++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h Fri Dec 16 13:40:58 2011 @@ -101,6 +101,7 @@ class Cluster : private Cpg::Handler, pu void addLocalConnection(const ConnectionPtr&); void addShadowConnection(const ConnectionPtr&); void erase(const ConnectionId&); +void eraseLocal(const ConnectionId&); // URLs of current cluster members. std::vector getIds() const; @@ -212,6 +213,7 @@ class Cluster : private Cpg::Handler, pu void memberUpdate(Lock&); void setClusterId(const framing::Uuid&, Lock&); void erase(const ConnectionId&, Lock&); +void eraseLocal(const ConnectionId&, Lock&); void requestUpdate(Lock& ); void initM
svn commit: r1197178 - /qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf
Author: mgoulish Date: Thu Nov 3 15:15:45 2011 New Revision: 1197178 URL: http://svn.apache.org/viewvc?rev=1197178&view=rev Log: I am removing DIGEST-MD5 from the mech list, because we cannot supply a username+passwd in the sasldb file without introducing a security hole to production systems. So now the only mech is ANONYMOUS -- and lots of changes to the comments to make it clear how to enable MD5 and how to add username+passwd for it. Also, one of the broker options that was mentioned in the old text was archaic -- updated that. Modified: qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf Modified: qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf?rev=1197178&r1=1197177&r2=1197178&view=diff == --- qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf (original) +++ qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf Thu Nov 3 15:15:45 2011 @@ -17,30 +17,64 @@ # under the License. # # -# This configuation allows for either SASL ANONYMOUS or DIGEST-MD5 -# authentication. The DIGEST-MD5 authentication is done on a -# username+password, which is stored in the sasldb_path -# file. Usernames and passwords can be added to the file using the -# command: +#- +# Mechanisms and Users +#- # -# saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u +# This default qpidd configuration allows for only SASL ANONYMOUS authentication. +# To additionally enable DIGEST-MD5 authentication: # -# The REALM is important and should be the same as the --auth-realm -# option to the broker. This lets the broker properly find the user in -# the sasldb file. +# 1. edit the mech_list below to read +# mech_list: DIGEST-MD5 ANONYMOUS # -# Existing user accounts may be listed with: +# 2. To add new a new user+password to the sasldb file: +# echo $PASSWD | saslpasswd2 -c -p -f $SASLTEST_DB -u QPID $USERNAME # -# sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb # -# NOTE: The sasldb file must be readable by the user running the qpidd -# daemon, and should be readable only by that user. +# PLEASE NOTE +# For production messaging systems, a high-security mechanism such as +# DIGEST-MD5 or PLAIN+SSL should be enabled. +# # pwcheck_method: auxprop auxprop_plugin: sasldb sasldb_path: /var/lib/qpidd/qpidd.sasldb -mech_list: DIGEST-MD5 ANONYMOUS +mech_list: ANONYMOUS + + + +#- +# Other Notes +#- +# +# 1. If you use a nonstandard location for your sasl_config directory, +#you can point qpidd to it by using the --sasl-config option. +#If your nonstandard sasl directory is $MY_SASL_DIR, put a copy +#of this file at $MY_SASL_DIR/qpidd.conf, alter the mech list as +#appropriate for your installation, and then use the saslpasswd2 +#command to add new user+passwd pairs: +# echo $PASSWD | saslpasswd2 -c -p -f $MY_SASL_DIR/qpidd.sasldb -u QPID $USERNAME +# +# +# 2. The standard location for the qpidd sasldb file is +# /var/lib/qpidd/qpidd.sasldb +# +# 3. You can see what usernames have been stored in the sasldb, with the +#sasldblistusers2 command. +# +# 4. The REALM is important and should be the same as the --realm +#option to the broker. This lets the broker properly find the user in +#the sasldb file. +# +# 5. The sasldb file must be readable by the user running the qpidd +#daemon, and should be readable only by that user. +# -#following line stops spurious 'sql_select option missing' errors when -#cyrus-sql-sasl plugin is installed + + +# The following line stops spurious 'sql_select option missing' errors when +# cyrus-sql-sasl plugin is installed sql_select: dummy select + + + - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1183121 - in /qpid/trunk/qpid/cpp/src: qpid/broker/SaslAuthenticator.cpp tests/sasl.mk tests/sasl_no_dir
Author: mgoulish Date: Thu Oct 13 21:50:56 2011 New Revision: 1183121 URL: http://svn.apache.org/viewvc?rev=1183121&view=rev Log: QPID-3528 sasl_set_path() does no check on the given directory, so when you get bad behavior later it can be hard to track down. Especially bad is its policy of defaulting to an alternate standard location if yours fails. That's a potential security bug. So this patch checks that your dir exists, and is readable, before calling sasl_set_path(). Either you get the sasl config dir you were expecting, Added: qpid/trunk/qpid/cpp/src/tests/sasl_no_dir (with props) Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp qpid/trunk/qpid/cpp/src/tests/sasl.mk Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp?rev=1183121&r1=1183120&r2=1183121&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Thu Oct 13 21:50:56 2011 @@ -30,6 +30,7 @@ #include #if HAVE_SASL +#include #include #include "qpid/sys/cyrus/CyrusSecurityLayer.h" using qpid::sys::cyrus::CyrusSecurityLayer; @@ -98,11 +99,33 @@ void SaslAuthenticator::init(const std:: // Check if we have a version of SASL that supports sasl_set_path() #if (SASL_VERSION_FULL >= ((2<<16)|(1<<8)|22)) // If we are not given a sasl path, do nothing and allow the default to be used. -if ( ! saslConfigPath.empty() ) { -int code = sasl_set_path(SASL_PATH_TYPE_CONFIG, - const_cast(saslConfigPath.c_str())); +if ( saslConfigPath.empty() ) { +QPID_LOG ( info, "SASL: no config path set - using default." ); +} +else { +struct stat st; + +// Make sure the directory exists and we can read up to it. +if ( ::stat ( saslConfigPath.c_str(), & st) ) { + // Note: not using strerror() here because I think its messages are a little too hazy. + if ( errno == ENOENT ) + throw Exception ( QPID_MSG ( "SASL: sasl_set_path failed: no such directory: " << saslConfigPath ) ); + if ( errno == EACCES ) + throw Exception ( QPID_MSG ( "SASL: sasl_set_path failed: cannot read parent of: " << saslConfigPath ) ); + // catch-all stat failure + throw Exception ( QPID_MSG ( "SASL: sasl_set_path failed: cannot stat: " << saslConfigPath ) ); +} + +// Make sure the directory is readable. +if ( ::access ( saslConfigPath.c_str(), R_OK ) ) { +throw Exception ( QPID_MSG ( "SASL: sasl_set_path failed: directory not readable:" << saslConfigPath ) ); +} + +// This shouldn't fail now, but check anyway. +int code = sasl_set_path(SASL_PATH_TYPE_CONFIG, const_cast(saslConfigPath.c_str())); if(SASL_OK != code) throw Exception(QPID_MSG("SASL: sasl_set_path failed [" << code << "] " )); + QPID_LOG(info, "SASL: config path set to " << saslConfigPath ); } #endif Modified: qpid/trunk/qpid/cpp/src/tests/sasl.mk URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl.mk?rev=1183121&r1=1183120&r2=1183121&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl.mk (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl.mk Thu Oct 13 21:50:56 2011 @@ -30,7 +30,7 @@ check_PROGRAMS+=sasl_version sasl_version_SOURCES=sasl_version.cpp sasl_version_LDADD=$(lib_client) -TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route sasl_fed_ex_route_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_dynamic_cluster +TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route sasl_fed_ex_route_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_dynamic_cluster sasl_no_dir LONG_TESTS += run_cluster_authentication_soak EXTRA_DIST += run_cluster_authentication_test \ sasl_fed\ @@ -43,7 +43,8 @@ EXTRA_DIST += run_cluster_authentication sasl_fed_ex_dynamic_cluster \ sasl_fed_ex_link_cluster\ sasl_fed_ex_queue_cluster \ - sasl_fed_ex_route_cluster + sasl_fed_ex_route_cluster \ + sasl_no_dir endif # HAVE_SASL Added: qpid/trunk/qpid/cpp/src/tests/sasl_no_dir URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_no_dir?rev=1183121&
svn commit: r1177412 - /qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
Author: mgoulish Date: Thu Sep 29 19:54:42 2011 New Revision: 1177412 URL: http://svn.apache.org/viewvc?rev=1177412&view=rev Log: QPID-3304 ( well, at least related to that jira ^^ ) Without these extra locks I got a broker SEGV during a federation test. 100% reproducible, 5 times. gsim suggested that this might be the issue. After placing these locks, no SEGV in many tries. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp?rev=1177412&r1=1177411&r2=1177412&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp Thu Sep 29 19:54:42 2011 @@ -59,6 +59,7 @@ Message::~Message() {} void Message::forcePersistent() { +sys::Mutex::ScopedLock l(lock); // only set forced bit if we actually need to force. if (! getAdapter().isPersistent(frames) ){ forcePersistentPolicy = true; @@ -95,16 +96,19 @@ bool Message::isImmediate() const const FieldTable* Message::getApplicationHeaders() const { +sys::Mutex::ScopedLock l(lock); return getAdapter().getApplicationHeaders(frames); } std::string Message::getAppId() const { +sys::Mutex::ScopedLock l(lock); return getAdapter().getAppId(frames); } bool Message::isPersistent() const { +sys::Mutex::ScopedLock l(lock); return (getAdapter().isPersistent(frames) || forcePersistentPolicy); } @@ -319,6 +323,7 @@ const std::string X_QPID_TRACE("x-qpid.t bool Message::isExcluded(const std::vector& excludes) const { +sys::Mutex::ScopedLock l(lock); const FieldTable* headers = getApplicationHeaders(); if (headers) { std::string traceStr = headers->getAsString(X_QPID_TRACE); @@ -490,6 +495,7 @@ void Message::resetDequeueCompleteCallba } uint8_t Message::getPriority() const { +sys::Mutex::ScopedLock l(lock); return getAdapter().getPriority(frames); } - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1156604 - in /qpid/trunk/qpid: cpp/src/qpid/broker/SaslAuthenticator.cpp specs/management-schema.xml
Author: mgoulish Date: Thu Aug 11 12:49:39 2011 New Revision: 1156604 URL: http://svn.apache.org/viewvc?rev=1156604&view=rev Log: two new management properties for connections: the sasl mechanism, and the ssf (security strength factor).also a change to logging level of one message, so that when we see the list of mechanisms, we will always also see which one was chosen. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp qpid/trunk/qpid/specs/management-schema.xml Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp?rev=1156604&r1=1156603&r2=1156604&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Thu Aug 11 12:49:39 2011 @@ -381,13 +381,17 @@ void CyrusAuthenticator::start(const str const char *challenge; unsigned int challenge_len; -QPID_LOG(debug, "SASL: Starting authentication with mechanism: " << mechanism); +// This should be at same debug level as mech list in getMechanisms(). +QPID_LOG(info, "SASL: Starting authentication with mechanism: " << mechanism); int code = sasl_server_start(sasl_conn, mechanism.c_str(), response.size() ? response.c_str() : 0, response.length(), &challenge, &challenge_len); processAuthenticationStep(code, challenge, challenge_len); +qmf::org::apache::qpid::broker::Connection* cnxMgmt = connection.getMgmtObject(); +if ( cnxMgmt ) +cnxMgmt->set_saslMechanism(mechanism); } void CyrusAuthenticator::step(const string& response) @@ -461,6 +465,9 @@ std::auto_ptr CyrusAuthen if (ssf) { securityLayer = std::auto_ptr(new CyrusSecurityLayer(sasl_conn, maxFrameSize)); } +qmf::org::apache::qpid::broker::Connection* cnxMgmt = connection.getMgmtObject(); +if ( cnxMgmt ) +cnxMgmt->set_saslSsf(ssf); return securityLayer; } Modified: qpid/trunk/qpid/specs/management-schema.xml URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/specs/management-schema.xml?rev=1156604&r1=1156603&r2=1156604&view=diff == --- qpid/trunk/qpid/specs/management-schema.xml (original) +++ qpid/trunk/qpid/specs/management-schema.xml Thu Aug 11 12:49:39 2011 @@ -262,6 +262,8 @@ + + - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1143536 - in /qpid/trunk/qpid/cpp: etc/ etc/sasl2/ examples/qmf-console/ include/qpid/agent/ include/qpid/client/ src/qpid/agent/ src/tests/
Author: mgoulish Date: Wed Jul 6 19:28:45 2011 New Revision: 1143536 URL: http://svn.apache.org/viewvc?rev=1143536&view=rev Log: JIRA 3337 no more defaulting to guest/guest username/password qpidd.sasldb is no longer created -- users who want usernames and passwords in there must create it. but a local qpidd.sasldb is (before this change) being created for 'make check' testing. The etc/sasl2/qpidd.conf file now has an explicit mech list -- so we will no longer default to the system-list. Modified: qpid/trunk/qpid/cpp/etc/Makefile.am qpid/trunk/qpid/cpp/etc/qpidd.conf qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf qpid/trunk/qpid/cpp/examples/qmf-console/ping.cpp qpid/trunk/qpid/cpp/examples/qmf-console/printevents.cpp qpid/trunk/qpid/cpp/include/qpid/agent/ManagementAgent.h qpid/trunk/qpid/cpp/include/qpid/client/Connection.h qpid/trunk/qpid/cpp/src/qpid/agent/ManagementAgentImpl.h qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Modified: qpid/trunk/qpid/cpp/etc/Makefile.am URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/etc/Makefile.am?rev=1143536&r1=1143535&r2=1143536&view=diff == --- qpid/trunk/qpid/cpp/etc/Makefile.am (original) +++ qpid/trunk/qpid/cpp/etc/Makefile.am Wed Jul 6 19:28:45 2011 @@ -30,30 +30,7 @@ nobase_sysconf_DATA = \ qpidd.conf if HAVE_SASL -SASL_DB = qpidd.sasldb - nobase_sysconf_DATA += \ $(SASL_CONF) -sasldbdir = $(localstatedir)/lib/qpidd -sasldb_DATA = $(SASL_DB) - -# Setup the default sasldb file with a single user, guest, with an -# obvious password. This user and password are the default for many -# clients. -# -# The realm specified by -u is very important, and QPID is the default -# for the broker so we use it here. The realm is important because it -# defaults to the local hostname of the machine running the -# broker. This may not seem to bad at first glance, but it means that -# the sasldb has to be tailored to each machine that would be running -# a broker, and if the machine ever changed its name the -# authentication would stop working until the sasldb was updated. For -# these reasons we always want the broker to specify a realm where its -# users live, and we want the users to exist in that realm as well. -$(SASL_DB): - echo guest | $(SASL_PASSWD) -c -p -f $(SASL_DB) -u QPID guest - -CLEANFILES=$(SASL_DB) - endif Modified: qpid/trunk/qpid/cpp/etc/qpidd.conf URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/etc/qpidd.conf?rev=1143536&r1=1143535&r2=1143536&view=diff == --- qpid/trunk/qpid/cpp/etc/qpidd.conf (original) +++ qpid/trunk/qpid/cpp/etc/qpidd.conf Wed Jul 6 19:28:45 2011 @@ -21,4 +21,4 @@ # # (Note: no spaces on either side of '='). Using default settings: # "qpidd --help" or "man qpidd" for more details. -cluster-mechanism=ANONYMOUS +cluster-mechanism=DIGEST-MD5 ANONYMOUS Modified: qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf?rev=1143536&r1=1143535&r2=1143536&view=diff == --- qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf (original) +++ qpid/trunk/qpid/cpp/etc/sasl2/qpidd.conf Wed Jul 6 19:28:45 2011 @@ -17,8 +17,8 @@ # under the License. # # -# This configuation allows for either SASL PLAIN or ANONYMOUS -# authentication. The PLAIN authentication is done on a +# This configuation allows for either SASL ANONYMOUS or DIGEST-MD5 +# authentication. The DIGEST-MD5 authentication is done on a # username+password, which is stored in the sasldb_path # file. Usernames and passwords can be added to the file using the # command: @@ -39,6 +39,7 @@ pwcheck_method: auxprop auxprop_plugin: sasldb sasldb_path: /var/lib/qpidd/qpidd.sasldb +mech_list: DIGEST-MD5 ANONYMOUS #following line stops spurious 'sql_select option missing' errors when #cyrus-sql-sasl plugin is installed Modified: qpid/trunk/qpid/cpp/examples/qmf-console/ping.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/examples/qmf-console/ping.cpp?rev=1143536&r1=1143535&r2=1143536&view=diff == --- qpid/trunk/qpid/cpp/examples/qmf-console/ping.cpp (original) +++ qpid/trunk/qpid/cpp/examples/qmf-console/ping.cpp Wed Jul 6 19:28:45 2011 @@ -31,9 +31,7 @@ using namespace qpid::console; int main_int(int /*argc*/, char** /*argv*/) { // -// Declare connection settings for the messaging broker. The settings default to -// localhost:5672 with user guest (password guest). Refer to the header file -// for full details. +// Declare connection settings for the messaging broker. // qpid::client::ConnectionS
svn commit: r1141644 - /qpid/trunk/qpid/cpp/src/Makefile.am
Author: mgoulish Date: Thu Jun 30 18:05:57 2011 New Revision: 1141644 URL: http://svn.apache.org/viewvc?rev=1141644&view=rev Log: Code Haiku Summer -- A new "dot h" Ripened by the drowsy sun. Doh! forgot makefile! Modified: qpid/trunk/qpid/cpp/src/Makefile.am Modified: qpid/trunk/qpid/cpp/src/Makefile.am URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/Makefile.am?rev=1141644&r1=1141643&r2=1141644&view=diff == --- qpid/trunk/qpid/cpp/src/Makefile.am (original) +++ qpid/trunk/qpid/cpp/src/Makefile.am Thu Jun 30 18:05:57 2011 @@ -652,6 +652,7 @@ libqpidbroker_la_SOURCES = \ qpid/broker/SessionState.h \ qpid/broker/SignalHandler.cpp \ qpid/broker/SignalHandler.h \ + qpid/broker/StatefulQueueObserver.h \ qpid/broker/System.cpp \ qpid/broker/System.h \ qpid/broker/ThresholdAlerts.cpp \ - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn propchange: r1104291 - svn:log
Author: mgoulish Revision: 1104291 Modified property: svn:log Modified: svn:log at Tue May 17 15:43:21 2011 -- --- svn:log (original) +++ svn:log Tue May 17 15:43:21 2011 @@ -1,2 +1 @@ -Remove support for archaic Boost version 1_32 ( 103200 ). -( As promised, long ago. ) +QPID-3262 - remove support for archain Boost 103200 - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1104291 - in /qpid/trunk/qpid/cpp: include/qpid/Options.h src/qpid/Options.cpp src/tests/.valgrind.supp
Author: mgoulish Date: Tue May 17 14:43:53 2011 New Revision: 1104291 URL: http://svn.apache.org/viewvc?rev=1104291&view=rev Log: Remove support for archaic Boost version 1_32 ( 103200 ). ( As promised, long ago. ) Modified: qpid/trunk/qpid/cpp/include/qpid/Options.h qpid/trunk/qpid/cpp/src/qpid/Options.cpp qpid/trunk/qpid/cpp/src/tests/.valgrind.supp Modified: qpid/trunk/qpid/cpp/include/qpid/Options.h URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/Options.h?rev=1104291&r1=1104290&r2=1104291&view=diff == --- qpid/trunk/qpid/cpp/include/qpid/Options.h (original) +++ qpid/trunk/qpid/cpp/include/qpid/Options.h Tue May 17 14:43:53 2011 @@ -133,77 +133,6 @@ inline po::value_semantic* optValue(bool -/* - * - - * Explanation for Boost 103200 conditional code - * - - * - * This boost version has an implementation of the program_options library - * that has no provision for allowing unregistered options to pass by. - * - * But that means that, if you have a program that loads optional modules - * after start-up, and those modules each have their own set of options, - * then if you parse the command line too soon, you will get spurious - * reports of unrecognized options -- and the program will exit! - * - * And we must process the command-line before module-loading, because we - * need to look at the "bootstrap" options. - * - * This conditional code: - * - * 1. implements it's own functor class, derived from the Boost - * "options_description_easy_init" class. This functor is used - * to process added options and do the functor chaining, so that - * I can snoop on the arguments before doing an explicit call - * to its parent. - * - * 2. It implements two static vectors, one to hold long names, and - * one for short names, so that options declared by modules are - * not forgotten when their options_description goes out of scope. - * - * I will be thrilled to personally delete this code if we ever decide - * that qpid doesn't really need to support this antique version of Boost. - * - */ - -#if ( BOOST_VERSION == 103200 ) -struct Options; - - -struct -options_description_less_easy_init - : public po::options_description_easy_init -{ - options_description_less_easy_init ( Options * my_owner, - po::options_description * my_parents_owner - ) -: po::options_description_easy_init(my_parents_owner) - { -owner = my_owner; - } - - - options_description_less_easy_init& - operator()(char const * name, - char const * description); - - - options_description_less_easy_init& - operator()(char const * name, - const po::value_semantic* s); - - - options_description_less_easy_init& - operator()(const char* name, - const po::value_semantic* s, - const char* description); - - - Options * owner; -}; -#endif - - struct Options : public po::options_description { struct Exception : public qpid::Exception { @@ -222,26 +151,9 @@ struct Options : public po::options_desc bool allowUnknown = false); - #if ( BOOST_VERSION == 103200 ) - options_description_less_easy_init m_less_easy; - - options_description_less_easy_init addOptions() { - return m_less_easy; - } - - bool - is_registered_option ( std::string s ); - - void - register_names ( std::string s ); - - static std::vector long_names; - static std::vector short_names; - #else boost::program_options::options_description_easy_init addOptions() { return add_options(); } - #endif }; Modified: qpid/trunk/qpid/cpp/src/qpid/Options.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/Options.cpp?rev=1104291&r1=1104290&r2=1104291&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/Options.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/Options.cpp Tue May 17 14:43:53 2011 @@ -30,23 +30,6 @@ namespace qpid { using namespace std; -/* - * - - * Explanation for Boost 103200 conditional code - * - - * - * Please see large comment in Options.h . - * - */ - -#if ( BOOST_VERSION == 103200 ) -std::vector Options::long_names; -std::vector Options::short_names; -#endif - - - - namespace { struct EnvOptMapper { @@ -69,49 +52,11 @@ struct EnvOptMapper { static const std::string prefix("QPID_"); if (envVar.substr(0, prefix.size()) == prefix) { string env = envVar.substr(prefix.size()); -#if (BOOST_VERSION >= 103300)
svn commit: r1098704 - /qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex
Author: mgoulish Date: Mon May 2 18:13:00 2011 New Revision: 1098704 URL: http://svn.apache.org/viewvc?rev=1098704&view=rev Log: QPID-3239 qpid-tool is no longer printing status of clustered broker links, so this test code (which is used by several tests) hangs. so make it look at the "transport" field instead. also -- if this test is run on a machine that is clustered with several others -- and if there is another copy of the test running on one of the other machines -- the brokers on the different machinnes will form One Big Cluster. append the box-name to the cluster name. Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex?rev=1098704&r1=1098703&r2=1098704&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Mon May 2 18:13:00 2011 @@ -19,7 +19,6 @@ # under the License. # - #=== # These tests create federated links between two brokers using SASL security. # The SASL mechanism used is EXTERNAL, which is satisfied by SSL @@ -56,6 +55,8 @@ function print { fi } +print "=== start sasl_fed_ex $* " + # This minimum value corresponds to sasl version 2.1.22 @@ -102,8 +103,11 @@ if [[ !(-x $CERTUTIL) ]] ; then fi delete_certs -create_certs || error "Could not create test certificate" - +create_certs 2> /dev/null +if [ ! $? ]; then + error "Could not create test certificate" + exit 1 +fi sasl_config_dir=$builddir/sasl_config @@ -124,9 +128,12 @@ DST_TCP_PORT=5807 SRC_TCP_PORT_2=5802 DST_TCP_PORT_2=5803 -CLUSTER_1_NAME=sasl_fed_ex_cluster_1 -CLUSTER_2_NAME=sasl_fed_ex_cluster_2 +CLUSTER_NAME_SUFFIX=`hostname | tr '.' ' ' | awk '{print $1}'` +CLUSTER_1_NAME=sasl_fed_ex_cluster_1_${CLUSTER_NAME_SUFFIX} +CLUSTER_2_NAME=sasl_fed_ex_cluster_2_${CLUSTER_NAME_SUFFIX} +print "CLUSTER_1_NAME == ${CLUSTER_1_NAME}" +print "CLUSTER_2_NAME == ${CLUSTER_2_NAME}" SSL_LIB=${moduledir}/ssl.so CLUSTER_LIB=${moduledir}/cluster.so @@ -313,32 +320,40 @@ elif [ ${qpid_route_method} == "route" ] else echo "unknown method: |${qpid_route_method}|" echo " choices are: dynamic|link|queue|route " - print "Asking brokers to quit." - $QPIDD_EXEC --port ${SRC_TCP_PORT} --quit - $QPIDD_EXEC --port ${DST_TCP_PORT} --quit - exit 2 + halt_brokers + exit 1 fi + # I don't know how to avoid this sleep yet. It has to come after route-creation # to avoid false negatives. sleep 5 # This should work the same whether or not we are running a clustered test. +# In the case of clustered tests, the status is not printed by qpid_route. +# So in either case, I will look only at the transport field, which should be "ssl". print "check the link" -link_status=$($QPID_ROUTE_EXEC link list localhost:${DST_TCP_PORT} | tail -1 | awk '{print $5}') -print "link_status == ${link_status}" +link_status=$($QPID_ROUTE_EXEC link list localhost:${DST_TCP_PORT} | tail -1 | awk '{print $3}') halt_brokers sleep 1 -if [ ${link_status} == "Operational" ]; then +if [ ! ${link_status} ]; then + print "link_status is empty" + print "result: fail" + exit 2 +fi + +if [ ${link_status} == "ssl" ]; then print "result: good" + # Only remove the tmp_root on success, to permit debugging. print "Removing temporary directory $tmp_root" rm -rf $tmp_root exit 0 fi +print "link_status has a bad value: ${link_status}" print "result: fail" exit 3 - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1089294 - /qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp
Author: mgoulish Date: Wed Apr 6 04:39:40 2011 New Revision: 1089294 URL: http://svn.apache.org/viewvc?rev=1089294&view=rev Log: gsim's patch to bring c++ logic in line with other clients. If there is no username, then do nothing with either NAME or PASSWD callbacks. If there is a name but no passwd, then explicitly store an empty PASSWD callback. Modified: qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp?rev=1089294&r1=1089293&r2=1089294&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp Wed Apr 6 04:39:40 2011 @@ -182,17 +182,18 @@ CyrusSasl::CyrusSasl(const std::string & callbacks[i].id = SASL_CB_AUTHNAME; callbacks[i].proc = (CallbackProc*) &getUserFromSettings; callbacks[i++].context = &settings; -} -callbacks[i].id = SASL_CB_PASS; -if (settings.password.empty()) { -callbacks[i].proc = 0; -callbacks[i++].context = 0; -} else { -callbacks[i].proc = (CallbackProc*) &getPasswordFromSettings; -callbacks[i++].context = &settings; +callbacks[i].id = SASL_CB_PASS; +if (settings.password.empty()) { +callbacks[i].proc = 0; +callbacks[i++].context = 0; +} else { +callbacks[i].proc = (CallbackProc*) &getPasswordFromSettings; +callbacks[i++].context = &settings; +} } + callbacks[i].id = SASL_CB_LIST_END; callbacks[i].proc = 0; callbacks[i++].context = 0; - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1087047 - /qpid/trunk/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp
Author: mgoulish Date: Wed Mar 30 19:11:09 2011 New Revision: 1087047 URL: http://svn.apache.org/viewvc?rev=1087047&view=rev Log: qpid-3171 The registration of the codec happens on a different thread from the use of the codec. It is possible for the registration to occur after the first attempted use. In my testing, this happened 3% of the time -- 165 times out of 5000 tests -- when using RDMA transport, and 0 times out of 5000 when using TCP. Which is why we didn't notice it earlier. We have a function that tells when we are ready to encode -- CyrusSecurityLayer::canEncode. But it does not check the validity of the codec pointer before using it, so it cores in this situation. I believe simply checking that pointer is probably the best solution. Introducing that check caused the crash not to show up in 10,000 trials. There were also no hangs. Modified: qpid/trunk/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp?rev=1087047&r1=1087046&r2=1087047&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp Wed Mar 30 19:11:09 2011 @@ -106,7 +106,7 @@ size_t CyrusSecurityLayer::encode(const bool CyrusSecurityLayer::canEncode() { -return encrypted || codec->canEncode(); +return codec && (encrypted || codec->canEncode()); } void CyrusSecurityLayer::init(qpid::sys::Codec* c) - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1082812 - in /qpid/trunk/qpid/cpp/src/tests: sasl_fed_ex_dynamic_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_route_cluster
Author: mgoulish Date: Fri Mar 18 03:12:57 2011 New Revision: 1082812 URL: http://svn.apache.org/viewvc?rev=1082812&view=rev Log: QPID-3153 added check for ais_exec running -- or don't run these clustered tests Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link_cluster qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route_cluster Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster?rev=1082812&r1=1082811&r2=1082812&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster Fri Mar 18 03:12:57 2011 @@ -21,7 +21,8 @@ source ./test_env.sh +source $srcdir/ais_check -${srcdir}/sasl_fed_ex dynamic cluster +with_ais_group ${srcdir}/sasl_fed_ex dynamic cluster Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link_cluster URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link_cluster?rev=1082812&r1=1082811&r2=1082812&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link_cluster (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link_cluster Fri Mar 18 03:12:57 2011 @@ -21,7 +21,8 @@ source ./test_env.sh +source $srcdir/ais_check -${srcdir}/sasl_fed_ex link cluster +with_ais_group ${srcdir}/sasl_fed_ex link cluster Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster?rev=1082812&r1=1082811&r2=1082812&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster Fri Mar 18 03:12:57 2011 @@ -21,7 +21,8 @@ source ./test_env.sh +source ${srcdir}/ais_check -${srcdir}/sasl_fed_ex queue cluster +with_ais_group ${srcdir}/sasl_fed_ex queue cluster Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route_cluster URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route_cluster?rev=1082812&r1=1082811&r2=1082812&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route_cluster (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route_cluster Fri Mar 18 03:12:57 2011 @@ -21,7 +21,8 @@ source ./test_env.sh +source ${srcdir}/ais_check -${srcdir}/sasl_fed_ex route cluster +with_ais_group ${srcdir}/sasl_fed_ex route cluster - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1082804 - /qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex
Author: mgoulish Date: Fri Mar 18 02:44:42 2011 New Revision: 1082804 URL: http://svn.apache.org/viewvc?rev=1082804&view=rev Log: QPID-3152 The non-clustered versions of the sasl_fed_ex tests should probably not attempt to load cluster.so. Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex?rev=1082804&r1=1082803&r2=1082804&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Fri Mar 18 02:44:42 2011 @@ -160,7 +160,7 @@ export QPID_SSL_CERT_NAME=${TEST_HOSTNAM COMMON_BROKER_OPTIONS=" \ --ssl-sasl-no-dict \ - --sasl-config=$sasl_config_dir\ + --sasl-config=$sasl_config_dir \ --ssl-require-client-authentication\ --auth yes \ --ssl-cert-db $CERT_DIR\ @@ -169,7 +169,6 @@ COMMON_BROKER_OPTIONS=" --no-data-dir \ --no-module-dir\ --load-module ${SSL_LIB} \ - --load-module ${CLUSTER_LIB} \ --mgmt-enable=yes \ --log-enable info+ \ --log-source yes \ @@ -186,6 +185,7 @@ function start_brokers { --port=${SRC_TCP_PORT} \ --ssl-port ${SRC_SSL_PORT} \ ${COMMON_BROKER_OPTIONS} \ + --load-module ${CLUSTER_LIB} \ --cluster-name ${CLUSTER_1_NAME} \ --log-to-file $tmp_root/qpidd_src.log 2> /dev/null @@ -196,6 +196,7 @@ function start_brokers { --port=${SRC_TCP_PORT_2} \ --ssl-port ${SRC_SSL_PORT_2} \ ${COMMON_BROKER_OPTIONS} \ + --load-module ${CLUSTER_LIB} \ --cluster-name ${CLUSTER_1_NAME} \ --log-to-file $tmp_root/qpidd_src_2.log 2> /dev/null @@ -209,6 +210,7 @@ function start_brokers { --port=${DST_TCP_PORT} \ --ssl-port ${DST_SSL_PORT} \ ${COMMON_BROKER_OPTIONS} \ + --load-module ${CLUSTER_LIB} \ --cluster-name ${CLUSTER_2_NAME} \ --log-to-file $tmp_root/qpidd_dst.log 2> /dev/null @@ -219,6 +221,7 @@ function start_brokers { --port=${DST_TCP_PORT_2} \ --ssl-port ${DST_SSL_PORT_2} \ ${COMMON_BROKER_OPTIONS} \ + --load-module ${CLUSTER_LIB} \ --cluster-name ${CLUSTER_2_NAME} \ --log-to-file $tmp_root/qpidd_dst_2.log 2> /dev/null @@ -329,12 +332,10 @@ halt_brokers sleep 1 -print "Removing temporary directory $tmp_root" -rm -rf $tmp_root - - if [ ${link_status} == "Operational" ]; then print "result: good" + print "Removing temporary directory $tmp_root" + rm -rf $tmp_root exit 0 fi - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1082685 - /qpid/trunk/qpid/cpp/src/tests/sasl_fed
Author: mgoulish Date: Thu Mar 17 20:45:55 2011 New Revision: 1082685 URL: http://svn.apache.org/viewvc?rev=1082685&view=rev Log: QPID-3150 This is a test-only fix. Tell the client explicitly to use DIGEST-MD5, rather than possibly defaulting to a mech that the test has not prepared for. Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed?rev=1082685&r1=1082684&r2=1082685&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed Thu Mar 17 20:45:55 2011 @@ -123,7 +123,7 @@ n_messages=100 #-- #echo " Sending 100 messages to $broker_1_port " #-- -$builddir/datagen --count $n_messages | $SENDER_EXEC --username zag --password zag --exchange $EXCHANGE_NAME --routing-key $ROUTING_KEY --port $broker_1_port +$builddir/datagen --count $n_messages | $SENDER_EXEC --mechanism DIGEST-MD5 --username zag --password zag --exchange $EXCHANGE_NAME --routing-key $ROUTING_KEY --port $broker_1_port sleep 5 - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn propchange: r1079808 - svn:log
Author: mgoulish Revision: 1079808 Modified property: svn:log Modified: svn:log at Wed Mar 9 14:13:53 2011 -- --- svn:log (original) +++ svn:log Wed Mar 9 14:13:53 2011 @@ -1 +1,2 @@ +QPID-1672 Add new cluster-based sasl_fed_ex tests to EXTRA-DIST - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1079808 - /qpid/trunk/qpid/cpp/src/tests/sasl.mk
Author: mgoulish Date: Wed Mar 9 14:10:45 2011 New Revision: 1079808 URL: http://svn.apache.org/viewvc?rev=1079808&view=rev Log: Add new cluster-based sasl_fed_ex tests to EXTRA-DIST Modified: qpid/trunk/qpid/cpp/src/tests/sasl.mk Modified: qpid/trunk/qpid/cpp/src/tests/sasl.mk URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl.mk?rev=1079808&r1=1079807&r2=1079808&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl.mk (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl.mk Wed Mar 9 14:10:45 2011 @@ -32,7 +32,18 @@ sasl_version_LDADD=$(lib_client) TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route sasl_fed_ex_route_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_dynamic_cluster LONG_TESTS += run_cluster_authentication_soak -EXTRA_DIST += run_cluster_authentication_test sasl_fed sasl_fed_ex run_cluster_authentication_soak sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route +EXTRA_DIST += run_cluster_authentication_test \ + sasl_fed\ + sasl_fed_ex \ + run_cluster_authentication_soak \ + sasl_fed_ex_dynamic \ + sasl_fed_ex_link\ + sasl_fed_ex_queue \ + sasl_fed_ex_route \ + sasl_fed_ex_dynamic_cluster \ + sasl_fed_ex_link_cluster\ + sasl_fed_ex_queue_cluster \ + sasl_fed_ex_route_cluster endif # HAVE_SASL - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org
svn commit: r1079539 - in /qpid/trunk/qpid/cpp/src/tests: sasl.mk sasl_fed_ex sasl_fed_ex_dynamic_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_route_cluster
Author: mgoulish Date: Tue Mar 8 20:59:26 2011 New Revision: 1079539 URL: http://svn.apache.org/viewvc?rev=1079539&view=rev Log: QPID-1672 clustered versions of the 4 federated sasl external tests. Added: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster (with props) qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link_cluster (with props) qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue_cluster (with props) qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route_cluster (with props) Modified: qpid/trunk/qpid/cpp/src/tests/sasl.mk qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Modified: qpid/trunk/qpid/cpp/src/tests/sasl.mk URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl.mk?rev=1079539&r1=1079538&r2=1079539&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl.mk (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl.mk Tue Mar 8 20:59:26 2011 @@ -30,7 +30,7 @@ check_PROGRAMS+=sasl_version sasl_version_SOURCES=sasl_version.cpp sasl_version_LDADD=$(lib_client) -TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route +TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route sasl_fed_ex_route_cluster sasl_fed_ex_link_cluster sasl_fed_ex_queue_cluster sasl_fed_ex_dynamic_cluster LONG_TESTS += run_cluster_authentication_soak EXTRA_DIST += run_cluster_authentication_test sasl_fed sasl_fed_ex run_cluster_authentication_soak sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex?rev=1079539&r1=1079538&r2=1079539&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Tue Mar 8 20:59:26 2011 @@ -124,6 +124,10 @@ DST_TCP_PORT=5807 SRC_TCP_PORT_2=5802 DST_TCP_PORT_2=5803 +CLUSTER_1_NAME=sasl_fed_ex_cluster_1 +CLUSTER_2_NAME=sasl_fed_ex_cluster_2 + + SSL_LIB=${moduledir}/ssl.so CLUSTER_LIB=${moduledir}/cluster.so @@ -182,7 +186,7 @@ function start_brokers { --port=${SRC_TCP_PORT} \ --ssl-port ${SRC_SSL_PORT} \ ${COMMON_BROKER_OPTIONS} \ - --cluster-name sasl_fed_ex_cluster \ + --cluster-name ${CLUSTER_1_NAME} \ --log-to-file $tmp_root/qpidd_src.log 2> /dev/null broker_ports[0]=${SRC_TCP_PORT} @@ -192,7 +196,7 @@ function start_brokers { --port=${SRC_TCP_PORT_2} \ --ssl-port ${SRC_SSL_PORT_2} \ ${COMMON_BROKER_OPTIONS} \ - --cluster-name sasl_fed_ex_cluster \ + --cluster-name ${CLUSTER_1_NAME} \ --log-to-file $tmp_root/qpidd_src_2.log 2> /dev/null broker_ports[1]=${SRC_TCP_PORT_2} @@ -205,7 +209,7 @@ function start_brokers { --port=${DST_TCP_PORT} \ --ssl-port ${DST_SSL_PORT} \ ${COMMON_BROKER_OPTIONS} \ - --cluster-name sasl_fed_ex_cluster \ + --cluster-name ${CLUSTER_2_NAME} \ --log-to-file $tmp_root/qpidd_dst.log 2> /dev/null broker_ports[2]=${DST_TCP_PORT} @@ -215,7 +219,7 @@ function start_brokers { --port=${DST_TCP_PORT_2} \ --ssl-port ${DST_SSL_PORT_2} \ ${COMMON_BROKER_OPTIONS} \ - --cluster-name sasl_fed_ex_cluster \ + --cluster-name ${CLUSTER_2_NAME} \ --log-to-file $tmp_root/qpidd_dst_2.log 2> /dev/null broker_ports[3]=${DST_TCP_PORT_2} @@ -316,11 +320,11 @@ fi # to avoid false negatives. sleep 5 +# This should work the same whether or not we are running a clustered test. print "check the link" link_status=$($QPID_ROUTE_EXEC link list localhost:${DST_TCP_PORT} | tail -1 | awk '{print $5}') print "link_status == ${link_status}" - halt_brokers sleep 1 Added: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster?rev=1079539&view=auto == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster (added) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic_cluster Tue Mar 8 20:59:26 2011 @@ -0,0 +1,27 @@ +#! /bin/bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses
svn commit: r1078745 - /qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex
Author: mgoulish Date: Mon Mar 7 11:22:19 2011 New Revision: 1078745 URL: http://svn.apache.org/viewvc?rev=1078745&view=rev Log: QPID-1672 The core script sasl_fed_ex ( used by sasl_fed_ex_* ) is modified to encapsulate broker creation, and handle clustering -- toggled by a new argument. This is an intermediate checkin. There are not yet any scripts that actually invoke the new clustering capability. Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex?rev=1078745&r1=1078744&r2=1078745&view=diff == --- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex (original) +++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Mon Mar 7 11:22:19 2011 @@ -30,20 +30,26 @@ source ./test_env.sh script_name=`basename $0` -if [ $# -ne 1 ] +if [ $# -lt 1 ] || [ $# -gt 2 ] then echo # These are the four different ways of creating links ( or routes+links ) # that the qpid-route command provides. - echo "Usage: ${script_name} dynamic|link|queue|route" + echo "Usage: ${script_name} dynamic|link|queue|route [cluster]" echo exit 1 fi +# Has the user told us to do clustering ? --- +clustering_flag= +if [ $# -eq "2" ] && [ "$2" == "cluster" ]; then + clustering_flag=true +fi + qpid_route_method=$1 +# Debugging print. -- debug= - function print { if [ "$debug" ]; then echo "${script_name}: $1" @@ -83,6 +89,7 @@ create_certs() { delete_certs() { if [[ -e ${CERT_DIR} ]] ; then +print "removing cert dir ${CERT_DIR}" rm -rf ${CERT_DIR} fi } @@ -98,19 +105,27 @@ delete_certs create_certs || error "Could not create test certificate" -sasl_config_file=$builddir/sasl_config +sasl_config_dir=$builddir/sasl_config -my_random_number=$RANDOM -tmp_root=/tmp/sasl_fed_$my_random_number +tmp_root=${builddir}/sasl_fed_ex_temp +print "results dir is ${tmp_root}" +rm -rf ${tmp_root} mkdir -p $tmp_root SRC_SSL_PORT=6667 DST_SSL_PORT= +SRC_SSL_PORT_2=6668 +DST_SSL_PORT_2=6669 + SRC_TCP_PORT=5801 DST_TCP_PORT=5807 -SSL_LIB=../.libs/ssl.so +SRC_TCP_PORT_2=5802 +DST_TCP_PORT_2=5803 + +SSL_LIB=${moduledir}/ssl.so +CLUSTER_LIB=${moduledir}/cluster.so export QPID_SSL_CERT_NAME=${TEST_HOSTNAME} @@ -139,48 +154,109 @@ export QPID_SSL_CERT_NAME=${TEST_HOSTNAM # 5. DST pulls messages off the temp queue on SRC to itself. # +COMMON_BROKER_OPTIONS=" \ + --ssl-sasl-no-dict \ + --sasl-config=$sasl_config_dir\ + --ssl-require-client-authentication\ + --auth yes \ + --ssl-cert-db $CERT_DIR\ + --ssl-cert-password-file $CERT_PW_FILE \ + --ssl-cert-name $TEST_HOSTNAME \ + --no-data-dir \ + --no-module-dir\ + --load-module ${SSL_LIB} \ + --load-module ${CLUSTER_LIB} \ + --mgmt-enable=yes \ + --log-enable info+ \ + --log-source yes \ + --daemon " + + +function start_brokers { + if [ $1 ]; then +# clustered +print "Starting SRC cluster" + +print " src broker 1" +$QPIDD_EXEC \ + --port=${SRC_TCP_PORT} \ + --ssl-port ${SRC_SSL_PORT} \ + ${COMMON_BROKER_OPTIONS} \ + --cluster-name sasl_fed_ex_cluster \ + --log-to-file $tmp_root/qpidd_src.log 2> /dev/null + +broker_ports[0]=${SRC_TCP_PORT} + +print " src broker 2" +$QPIDD_EXEC \ + --port=${SRC_TCP_PORT_2} \ + --ssl-port ${SRC_SSL_PORT_2} \ + ${COMMON_BROKER_OPTIONS} \ + --cluster-name sasl_fed_ex_cluster \ + --log-to-file $tmp_root/qpidd_src_2.log 2> /dev/null + +broker_ports[1]=${SRC_TCP_PORT_2} + + +print "Starting DST cluster" + +print " dst broker 1" +$QPIDD_EXEC \ + --port=${DST_TCP_PORT} \ + --ssl-port ${DST_SSL_PORT} \ + ${COMMON_BROKER_OPTIONS} \ + --cluster-name sasl_fed_ex_cluster \ + --log-to-file $tmp_root/qpidd_dst.log 2> /dev/null + +broker_ports[2]=${DST_TCP_PORT} + +print " dst broker 2" +$QPIDD_EXEC
svn commit: r1078107 - /qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp
Author: mgoulish Date: Fri Mar 4 19:16:53 2011 New Revision: 1078107 URL: http://svn.apache.org/viewvc?rev=1078107&view=rev Log: QPID-3117 Fix misleading --help info on --sasl-config flag. Its argument is not a file, it's a directory. Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1078107&r1=1078106&r2=1078107&view=diff == --- qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/Broker.cpp Fri Mar 4 19:16:53 2011 @@ -152,7 +152,7 @@ Broker::Options::Options(const std::stri ("tcp-nodelay", optValue(tcpNoDelay), "Set TCP_NODELAY on TCP connections") ("require-encryption", optValue(requireEncrypted), "Only accept connections that are encrypted") ("known-hosts-url", optValue(knownHosts, "URL or 'none'"), "URL to send as 'known-hosts' to clients ('none' implies empty list)") -("sasl-config", optValue(saslConfigPath, "FILE"), "gets sasl config from nonstandard location") +("sasl-config", optValue(saslConfigPath, "DIR"), "gets sasl config info from nonstandard location") ("max-session-rate", optValue(maxSessionRate, "MESSAGES/S"), "Sets the maximum message rate per session (0=unlimited)") ("async-queue-events", optValue(asyncQueueEvents, "yes|no"), "Set Queue Events async, used for services like replication") ("default-flow-stop-threshold", optValue(queueFlowStopRatio, "%MESSAGES"), "Queue capacity level at which flow control is activated.") - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org