Timo Sirainen [Wed, 5 Oct 2016 11:18:07 +0000 (14:18 +0300)]
lib: [ip]_free(mem) is now also guaranteed to set mem=NULL
It was already doing it, but updated the macros and comments to make it
clear that this won't change in future. Changing this would only make it
more likely that bugs occur and the performance improvements would be
close to nonexistent.
Phil Carmody [Wed, 5 Oct 2016 12:03:05 +0000 (15:03 +0300)]
plugins/fts - make storage errors more informative
There are 3 different ways to fail ending a transaction (one
of which is itself just a record that something now unknown
previously failed). Identify which one in the logs.
Timo Sirainen [Tue, 27 Sep 2016 16:48:14 +0000 (19:48 +0300)]
lib-index: If view syncing sees index is reset, always mark the view as inconsistent.
Not only when the mailbox has messages, because that could still mess up
assumptions about UIDs. A somewhat better check could have been to do this
only when next_uid>1 (= there have been messages at some point in this
mailbox), but it's safer to just always mark the view as inconsistent.
Stephan Bosch [Mon, 26 Sep 2016 19:04:44 +0000 (21:04 +0200)]
lib: uri-util: Implemented API to check generic URI syntax.
This allows checking whether something is a valid URI of any type.
This change adds a test suite for the generic URI syntax, which is currently the main purpose of the API addition.
Apart from a few simple vality checks, the test suite also tests various URI examples from RFCs.
Timo Sirainen [Fri, 30 Sep 2016 10:04:48 +0000 (13:04 +0300)]
lib-test: Allow test_istream_set_*() for test-istream's children.
It will internally find the test_istream from parents. This simplifies the
testing code so that it doesn't have to keep track of both the test_istream
and the final istream.
Timo Sirainen [Thu, 29 Sep 2016 11:15:32 +0000 (14:15 +0300)]
lib-storage: Don't reset mail_save_context.saving too early.
If mailbox_save_using_mail() ended up in mail_storage_copy(), saving was set
to FALSE before the copy() method was finished running. This caused e.g.
notify plugin to think that this was a copy event instead of a save event.
Added comments and asserts to clarify how the logic should work between
all the different copying/moving/saving flags.
The counter was increased even if the UID was already in recent_flags.
This is the only place where I found that recent_flags and
recent_flags_count could become desynced (which they definitely were in
a core dump), so hopefully this fixes assert-crashes like:
Timo Sirainen [Mon, 26 Sep 2016 12:38:27 +0000 (15:38 +0300)]
dict-client: Fixed lock and ioloop wait timings in log messages.
Previously it was logging the total amount of time spent on lock waits or on
ioloop during the existence of the entire process, rather than how much time
the command itself was spending on those. This wasn't very useful.
Now it also tries to separate the time spent on the main ioloop and in
dict_wait().
Timo Sirainen [Mon, 26 Sep 2016 13:34:23 +0000 (16:34 +0300)]
dict-client: Remove timeout when there are only background commands.
Normally the timeout wasn't added in the first place, but it was if a
non-background command was added first and it was followed by a background
command.
Timo Sirainen [Tue, 20 Sep 2016 15:08:10 +0000 (18:08 +0300)]
lib-dcrypt: Don't finalize encryption on o_stream_flush()
For example the default o_stream_uncork() implementation enforces flushing
and it's probably better not to change that. In general there's really no
reason to perform the finalization at flush when the stream can't be written
to anymore (whereas lib-compression ostreams allow writes after flushes).
Timo Sirainen [Thu, 15 Sep 2016 08:30:15 +0000 (11:30 +0300)]
lib: safe_mkstemp*() didn't always truncate prefix back to original on failure.
This caused repeated safe_mkstemp*() calls with the same prefix to keep
increasing its size. It probably didn't really break anything (unless it was
called enough many times to reach 255 filename length), but the filenames
were still confusingly ugly.
Timo Sirainen [Wed, 14 Sep 2016 11:19:39 +0000 (14:19 +0300)]
iostream-temp: If write() to temp file fails at any time, move it back to memory.
Similarly to if the write() to temp fails during the initial move attempt.
This way even if write() fails due to out of disk space, it's not visible
to caller. An error message is logged in any case.
index_storage_attribute_{set,get} should assume that the caller performed
due diligence and checked whether or not the user is allowed to store under
the key.
Stephan Bosch [Tue, 13 Sep 2016 20:54:02 +0000 (22:54 +0200)]
lib-http: client: Fixed hang occurring when nested ioloops are used in response callbacks.
To prevent missing disconnect events, i_stream_read() is called once a change in ioloop is detected.
However, if something was actually read into the stream, the input handler was never called.
So, a response could linger in the stream buffer, without being handled, thereby causing the connection to hang indefinitely.
An additional input event could end the hang, but sometimes this doesn't happen before the request times out.
This problem was seen in test-http-payload once in about 10 invocations.
Obox uses nested ioloops, to this applies there.
Timo Sirainen [Sat, 10 Sep 2016 08:28:38 +0000 (11:28 +0300)]
lib-lda: Cleanup error handling in LMTP client code.
If there are no successful recipients, we'll need to deinit the client.
But at that point we've already called all the callbacks, so the line
parameter to lmtp_client_fail_full() isn't actually used anywhere.
This was confusing static analyzer because global_fail_string was used
as parameter, which could have been NULL and wouldn't have been valid
for the callbacks.