Timo Sirainen [Thu, 1 Oct 2020 12:36:08 +0000 (15:36 +0300)]
lib-compression: Add istream-decompress
This stream detects the compression format and creates the proper istream
afterwards. This is more efficient than creating each compression istream
and using istream-try.
This allows the read() implementation to read data into the existing
memarea. Otherwise a new memarea might have to be created because the old
one is referenced by the snapshot.
Timo Sirainen [Thu, 29 Oct 2020 11:35:35 +0000 (13:35 +0200)]
imap: Process title wrongly shows connections are "corked"
The flush callback in ostream-file always corks the connection, so the
process title needs to be delayed until it's no longer in that callback.
Add a 0-timeout to update the process title.
Timo Sirainen [Tue, 10 Nov 2020 14:10:05 +0000 (16:10 +0200)]
login-proxy: Use persistent istream buffers
Constantly freeing and allocating the memory is a bit slow, but because
Dovecot allocates all memory with calloc() the memory cleaing is especially
slow. With this change proxying lots of data in a plaintext connection
takes about 50% less CPU. The downside is that it uses about 4 kB more
memory per istream (8 kB total, for both client and server connections),
but that shouldn't be too bad for proxies since they don't use much memory
otherwise.
Stephan Bosch [Tue, 1 Dec 2020 09:25:09 +0000 (10:25 +0100)]
lib-http: http-client-request - Fix payload assertions in http_client_request_send_more().
When the request payload is finished, both req->payload_input and
req->payload_output could be NULL, so the assertions on those being not NULL
need to happen after the check for req->payload_finished.
This particularly causes problems with the
blocking http_client_request_send/finish_payload() API, which constantly
modifies req->payload_input and sets it to NULL to finish the output.
Timo Sirainen [Thu, 29 Oct 2020 10:55:21 +0000 (12:55 +0200)]
imap: Fix potential hang if client disconnects with pipelined ambiguous commands
For example if client pipelines FETCH+LOGOUT commands and disconnects during
a large FETCH output, the LOGOUT command is processed as waiting for
unambiguity. This code path however doesn't detect a client disconnection,
and input IO handler is removed so it can't detect it either. So the imap
process hangs.
Timo Sirainen [Mon, 10 Aug 2020 14:33:07 +0000 (17:33 +0300)]
lib-index: mail_index_sync_map() - Always return -1 on I/O failures
Even though with force=FALSE in theory it would be possible to work around
it, but more likely it will just cause another I/O error. This simplifies
the code for the following changes.
Although the old code worked as well, it wasn't so obvious since the
behavior was slightly different when the log->head had extra references.
Clarify the behavior by always unreferencing after the new log file is
created.
Timo Sirainen [Mon, 10 Aug 2020 16:54:55 +0000 (19:54 +0300)]
lib-index: mail_transaction_log_view_set() - Make sure log files aren't freed too early
It's possible that mail_transaction_log_find_file() frees one of the files
that are already in the linked list. Avoid it by referencing the file
immediately when it's added to the list.
Timo Sirainen [Mon, 10 Aug 2020 14:12:32 +0000 (17:12 +0300)]
lib-index: mail_transaction_log_view_set() - Return -1 only on I/O error
The callers that care about the difference:
* mail_index_sync_map() already assumes that -1 means I/O error
* mail_index_sync_set_log_view() handles 0 by logging an error and fscking
the index, which is likely better than just returning failure.
* view_sync_set_log_view_range()'s caller handles 0 by rebuilding the
missing changes in memory. So returning 0 makes it work better.
* dsync_log_set() and mailbox_get_expunges_init() have fallbacks for
handling 0, while -1 would just return an error.
Markus Valentin [Fri, 20 Nov 2020 11:52:47 +0000 (12:52 +0100)]
doveadm: mail: doveadm_mail_failed_error() - Set specific exit code for MAIL_ERROR_INUSE
Set exit code DOVEADM_EX_NOTPOSSIBLE in case MAIL_ERROR_INUSE is set via
doveadm_mail_failed_error(). This exit code is used to indicate that a
operation cannot be done because another session prevents it.
Timo Sirainen [Fri, 20 Nov 2020 10:15:18 +0000 (12:15 +0200)]
doveadm: When sending server logs to client, make sure ioloop isn't set to NULL
This could have happened if there was any logging done outside command
handling. For example a doveadm command used http-client, which has a
timeout that triggers logging only after the command is finished.
lib: event-filter - Do not assert that there in no output on error
When the input is a simple (but invalid) expression (e.g., a=b=c) the output
variable may be set. This is perfectly fine.
The assertion (and the associated failure) come from when event filter
parsing was switched to the new filter syntax
(fcba1d530737813de11d9d730d5db6496e2e574b).