dovecot-2.0: imap: Added module_contexts to struct client.

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 05:46:27 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/57814e99b451
changeset: 10696:57814e99b451
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Feb 13 05:44:09 2010 +0200
description:
imap: Added module_contexts to struct client.

diffstat:

 src/imap/imap-client.c |  11 +++++++----
 src/imap/imap-client.h |   4 ++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diffs (70 lines):

diff -r fd5141e85076 -r 57814e99b451 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Sat Feb 13 05:43:50 2010 +0200
+++ b/src/imap/imap-client.c	Sat Feb 13 05:44:09 2010 +0200
@@ -38,12 +38,15 @@
 {
 	struct client *client;
 	const char *ident;
+	pool_t pool;
 
 	/* always use nonblocking I/O */
 	net_set_nonblock(fd_in, TRUE);
 	net_set_nonblock(fd_out, TRUE);
 
-	client = i_new(struct client, 1);
+	pool = pool_alloconly_create("imap client", 512);
+	client = p_new(pool, struct client, 1);
+	client->pool = pool;
 	client->set = set;
 	client->service_user = service_user;
 	client->fd_in = fd_in;
@@ -54,6 +57,7 @@
 
 	o_stream_set_flush_callback(client->output, client_output, client);
 
+	p_array_init(&client->module_contexts, client->pool, 5);
 	client->io = io_add(fd_in, IO_READ, client_input, client);
         client->last_input = ioloop_time;
 	client->to_idle = timeout_add(CLIENT_IDLE_TIMEOUT_MSECS,
@@ -67,7 +71,7 @@
 					      &mail_storage_callbacks, client);
 
 	client->capability_string =
-		str_new(default_pool, sizeof(CAPABILITY_STRING)+32);
+		str_new(client->pool, sizeof(CAPABILITY_STRING)+64);
 	str_append(client->capability_string, *set->imap_capability != '\0' ?
 		   set->imap_capability : CAPABILITY_STRING);
 
@@ -218,10 +222,9 @@
 		array_free(&client->search_saved_uidset);
 	if (array_is_created(&client->search_updates))
 		array_free(&client->search_updates);
-	str_free(&client->capability_string);
 	pool_unref(&client->command_pool);
 	mail_storage_service_user_free(&client->service_user);
-	i_free(client);
+	pool_unref(&client->pool);
 
 	master_service_client_connection_destroyed(master_service);
 	imap_refresh_proctitle();
diff -r fd5141e85076 -r 57814e99b451 src/imap/imap-client.h
--- a/src/imap/imap-client.h	Sat Feb 13 05:43:50 2010 +0200
+++ b/src/imap/imap-client.h	Sat Feb 13 05:44:09 2010 +0200
@@ -94,6 +94,7 @@
 	struct ostream *output;
 	struct timeout *to_idle, *to_idle_output;
 
+	pool_t pool;
 	struct mail_storage_service_user *service_user;
         const struct imap_settings *set;
 	string_t *capability_string;
@@ -131,6 +132,9 @@
 	/* command changing the mailbox */
 	struct client_command_context *mailbox_change_lock;
 
+	/* Module-specific contexts. */
+	ARRAY_DEFINE(module_contexts, union imap_module_context *);
+
 	/* syncing marks this TRUE when it sees \Deleted flags. this is by
 	   EXPUNGE for Outlook-workaround. */
 	unsigned int sync_seen_deletes:1;


More information about the dovecot-cvs mailing list