Commit Graph

13 Commits (4e7b66567268ecb42eb55ac588ca401384835a38)

Author SHA1 Message Date
Manos Pitsidianakis 4e7b665672
sqlite caching refactor
General refactoring to make blocking operations use special blocking
thread workers, SQL operations to use transactions, and setting up WAL
journal mode mode to minimize locking.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 873a67d0fb
Replace erroneous use of set_err_kind with set_kind
set_err_kind() is a method of the IntoError trait, not an Error method;
it is meant to be used for any error type that can be converted into
Error. Since melib::Error implements Into<melib::Error> tautologically,
this was not a compilation error. Nevertheless, the correct thing to do
is use the type method directly to set ErrorKind.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
4 months ago
Manos Pitsidianakis f900dbea46
Use cargo-derivefmt to sort derives alphabetically
Used https://github.com/dcchut/cargo-derivefmt

With command:

cargo install --locked \
--git https://github.com/dcchut/cargo-derivefmt \
--bin cargo-derivefmt \
--rev 2ff93de7fb418180458dd1ba27e5655607c23ab6

Since it's not on crates.io at the moment.

Sample diff:

  -#[derive(Debug, Deserialize, Clone, Serialize)]
  +#[derive(Clone, Debug, Deserialize, Serialize)]

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
6 months ago
Manos Pitsidianakis 8a21be2177
melib/imap: replace splice with truncate
splice() was calling memmove, it is a really inefficient way of
truncating a string.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
7 months ago
Manos Pitsidianakis f702dc220c
Fix new clippy lints.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
7 months ago
Manos Pitsidianakis 9b9c38f769
mellib/imap: don't flood user with sqlite3 errors if db is corrupted
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
9 months ago
Manos Pitsidianakis b4f2f33576
remove deflate feature; make it a hard dependency
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
9 months ago
Manos Pitsidianakis b3858de2f4
melib/error: impl From<io::ErrorKind> for ErrorKind
We inspect errors in the frontend to check for network errors. If the
network error comes from std::io, this would get converted to an Error
with description "timed out", kind OSError, and source the actual
networking error.

This commit converts network std::io::ErrorKinds into appropriate
native ErrorKinds.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis dc2b00442b
melib: run rustfmt and cargo-sort 10 months ago
Damian Poddebniak 4f6081b663 chore: Update to `imap-codec 1.0.0-beta`. 10 months ago
Manos Pitsidianakis 97d3686815
melib/connections: use Happy Eyeballs algorithm Ꙭ
This commit adds a Happy Eyeballs [1] implementation taken from the
happy-eyeballs crate, which is in public domain.

While the function lookup_ip[0] iterates through the addresses returned by
A and AAAA records from a DNS lookup, it returns the first one  which
always is an IPv4 address, unless there only is an AAAA record.

RFC6555 [1] recommends an algorithm for choosing the fastest address to
connect to, called "Happy Eyeballs". Ꙭ

[0]: melib/src/utils/connections.rs:497
[1]: https://www.rfc-editor.org/rfc/rfc6555

Fixes #268
10 months ago
Manos Pitsidianakis 8cb2a515e1
melib/smtp: use localhost in lieu of 127.0.0.1 for CI 10 months ago
Manos Pitsidianakis 1e084c1d85
melib: move backends out of the backends module
No reason to have such a deep module tree.
11 months ago