summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2015-05-05 23:38:55 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2015-05-06 23:52:26 -0700
commit9ba22a5947e1adc28c81e31a14029301107aca18 (patch)
treef256b3fc27225fb44c9b0b9e9669d12728055652
parent90895329fecd9bc14a8f3fc454d8b0d6555e98a9 (diff)
downloadrabbitmq-c-9ba22a5947e1adc28c81e31a14029301107aca18.tar.gz
Add amqp_get_client_properties function
-rw-r--r--librabbitmq/amqp.h16
-rw-r--r--librabbitmq/amqp_connection.c6
-rw-r--r--librabbitmq/amqp_private.h1
-rw-r--r--librabbitmq/amqp_socket.c5
4 files changed, 26 insertions, 2 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index 44477e5..a19d5a8 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -2388,6 +2388,22 @@ AMQP_PUBLIC_FUNCTION
amqp_table_t *
amqp_get_server_properties(amqp_connection_state_t state);
+/**
+ * Get the client properties table
+ *
+ * Get the properties that were passed to the broker on connection.
+ *
+ * \param [in] state the connection object
+ * \return a pointer to an amqp_table_t containing the properties advertised
+ * by the client on connection. The connection object owns the table, it
+ * should not be modified.
+ *
+ * \since v0.7.0
+ */
+AMQP_PUBLIC_FUNCTION
+amqp_table_t *
+amqp_get_client_properties(amqp_connection_state_t state);
+
AMQP_END_DECLS
diff --git a/librabbitmq/amqp_connection.c b/librabbitmq/amqp_connection.c
index 943e7ce..d2a0d41 100644
--- a/librabbitmq/amqp_connection.c
+++ b/librabbitmq/amqp_connection.c
@@ -578,3 +578,9 @@ amqp_get_server_properties(amqp_connection_state_t state)
{
return &state->server_properties;
}
+
+amqp_table_t *
+amqp_get_client_properties(amqp_connection_state_t state)
+{
+ return &state->client_properties;
+}
diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h
index 80bcfe0..81c0b84 100644
--- a/librabbitmq/amqp_private.h
+++ b/librabbitmq/amqp_private.h
@@ -187,6 +187,7 @@ struct amqp_connection_state_t_ {
amqp_rpc_reply_t most_recent_api_result;
amqp_table_t server_properties;
+ amqp_table_t client_properties;
amqp_pool_t properties_pool;
};
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index bb90477..6cc810e 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -1257,11 +1257,12 @@ static amqp_rpc_reply_t amqp_login_inner(amqp_connection_state_t state,
sizeof(default_properties) / sizeof(amqp_table_entry_t);
res = amqp_merge_capabilities(&default_table, client_properties,
- &s.client_properties, channel_pool);
- if (AMQP_STATUS_OK == res) {
+ &state->client_properties, channel_pool);
+ if (AMQP_STATUS_OK != res) {
goto error_res;
}
+ s.client_properties = state->client_properties;
s.mechanism = sasl_method_name(sasl_method);
s.response = response_bytes;
s.locale = amqp_cstring_bytes("en_US");