]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Avoid hanging with SSL
authorTimo Sirainen <tss@iki.fi>
Mon, 31 Jan 2011 17:05:18 +0000 (19:05 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 31 Jan 2011 17:05:18 +0000 (19:05 +0200)
src/lib-storage/index/imapc/imapc-connection.c

index af96dbcd225c1ac3aaf5d768856c003519244836..310c099c9af410eb75d9015a3148613669126ef2 100644 (file)
@@ -852,9 +852,12 @@ static void imapc_connection_input(struct imapc_connection *conn)
 {
        ssize_t ret;
 
-       if ((ret = i_stream_read(conn->input)) > 0)
+       /* we need to read as much as we can with SSL streams to avoid
+          hanging */
+       while (conn->input != NULL && (ret = i_stream_read(conn->input)) > 0)
                imapc_connection_input_pending(conn);
-       else if (ret < 0) {
+
+       if (ret < 0) {
                /* disconnected */
                if (conn->ssl_iostream == NULL) {
                        i_error("imapc(%s): Server disconnected unexpectedly",