summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_private.h
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2013-06-21 16:57:32 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2013-06-21 16:57:32 -0700
commit4a2d899cd3ae3ef8bb9305eddd88c95d3dfc0463 (patch)
tree5d40072884197ddcd5cb3e71ecb4455f30a7881b /librabbitmq/amqp_private.h
parent837a0b540595f8d0fab3214b0126ef436712aa98 (diff)
downloadrabbitmq-c-4a2d899cd3ae3ef8bb9305eddd88c95d3dfc0463.tar.gz
Channel-based memory management
Assign a decoding pool on a per-channel basis. This allows memory to be released on a per-channel basis which is helpful for clients handling multiple channels
Diffstat (limited to 'librabbitmq/amqp_private.h')
-rw-r--r--librabbitmq/amqp_private.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h
index e152c8c..baf96e1 100644
--- a/librabbitmq/amqp_private.h
+++ b/librabbitmq/amqp_private.h
@@ -119,15 +119,27 @@ typedef struct amqp_link_t_ {
void *data;
} amqp_link_t;
+#define POOL_TABLE_SIZE 16
+
+typedef struct amqp_pool_table_entry_t_ {
+ struct amqp_pool_table_entry_t_ *next;
+ amqp_pool_t pool;
+ amqp_channel_t channel;
+} amqp_pool_table_entry_t;
+
struct amqp_connection_state_t_ {
- amqp_pool_t frame_pool;
- amqp_pool_t decoding_pool;
+ amqp_pool_table_entry_t *pool_table[POOL_TABLE_SIZE];
amqp_connection_state_enum state;
int channel_max;
int frame_max;
int heartbeat;
+
+ /* buffer for holding frame headers. Allows us to delay allocating
+ * the raw frame buffer until the type, channel, and size are all known
+ */
+ char header_buffer[HEADER_SIZE + 1];
amqp_bytes_t inbound_buffer;
size_t inbound_offset;
@@ -147,6 +159,9 @@ struct amqp_connection_state_t_ {
amqp_rpc_reply_t most_recent_api_result;
};
+amqp_pool_t *amqp_get_or_create_channel_pool(amqp_connection_state_t connection, amqp_channel_t channel);
+amqp_pool_t *amqp_get_channel_pool(amqp_connection_state_t state, amqp_channel_t channel);
+
static inline void *amqp_offset(void *data, size_t offset)
{
return (char *)data + offset;