[dovecot-cvs] dovecot/src/imap client.c,1.76,1.77

tss at dovecot.org tss at dovecot.org
Tue Feb 6 18:50:55 UTC 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv3642

Modified Files:
	client.c 
Log Message:
hangfix



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- client.c	6 Feb 2007 12:56:12 -0000	1.76
+++ client.c	6 Feb 2007 18:50:52 -0000	1.77
@@ -397,6 +397,15 @@
 	}
 }
 
+static void client_add_missing_io(struct client *client)
+{
+	if (client->io == NULL) {
+		i_assert(i_stream_get_fd(client->input) >= 0);
+		client->io = io_add(i_stream_get_fd(client->input),
+				    IO_READ, _client_input, client);
+	}
+}
+
 void client_continue_pending_input(struct client *client)
 {
 	size_t size;
@@ -417,11 +426,7 @@
 			return;
 	}
 
-	if (client->io == NULL) {
-		i_assert(i_stream_get_fd(client->input) >= 0);
-		client->io = io_add(i_stream_get_fd(client->input),
-				    IO_READ, _client_input, client);
-	}
+	client_add_missing_io(client);
 
 	/* if there's unread data in buffer, handle it. */
 	(void)i_stream_get_data(client->input, &size);
@@ -459,6 +464,7 @@
 		if (cmd->func(cmd) || cmd->param_error) {
 			/* command execution was finished */
 			client_command_free(cmd);
+			client_add_missing_io(client);
 			return TRUE;
 		}
 
@@ -553,6 +559,8 @@
 	struct client_command_context *cmd;
 	int ret;
 
+	i_assert(client->io != NULL);
+
 	client->last_input = ioloop_time;
 
 	switch (i_stream_read(client->input)) {



More information about the dovecot-cvs mailing list