| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
| |
| |
| |
| |
| | |
This commit renames the sha256 column to docid for the reason that we
agreed upon making the schema visible to all modules, so if we were to
encapsulate docid properly, this change is only natural.
|
| | |
| |
| |
| |
| |
| | |
This commit introduces a new type in the database module named
`DocumentId` for abstracting the underlying content-addressable hash
algorithm we are using.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit makes the downloader found in `mirror::operation::download`
stateless by removing the `preferred_authority` field and changing all
methods from `&mut self` to `&self`.
The preferred authority is now accepted as a parameter to
`DownloadManager::download` which also returns a tuple now with the
actually used authority alongside the response, putting the management
of this to the responsibility of the caller.
Meanwhile, it also renames the structure from `ConsensusBoundDownloader`
to `DownloadManager` because it no longer keeps a state that
invalidates after a consensus "ends".
The purpose of this is to simplify overall state in order to make the
implementation of a finite-state-machine for the dirmirror operation
more easy (and deterministic).
|
| |/
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes the flaky `request_fail_ultimately` in tor-dirserver,
which is flaky due to the operating system's handling of TCP RSTs, which
are generally detected stochastically and sometimes are not received
even after the entire response has been parsed.
This leads to tor-dirclient either returning a connection reset or a
truncated header error, depending on whether it successfully or
unsuccessfully reads zero bytes from the server.
Fixes #2318
|
| | |
|
| |
|
|
|
|
| |
This commit modifies the database::store_insert logic to accept an
iterator of the encodings to store the document in, instead of encoding
it with all encodings we support.
|
| |
|
|
| |
Instead of failing, add them to missing and query them again.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
This commit implements the logic necessary to retrieve the (missing)
directory authority certificates from an upstream directory authority.
In order to do so, this commit implements three new functions:
1. `download_authority_certificates()`
2. `parse_authority_certificates()`
3. `verify_authority_certificates()`
4. `insert_authority_certificates()`
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
This commit adds the `get_recent_authority_certificates()` function to
the operation of a directory mirror, which is responsible for looking up
the certificates in the database, returning the parsed found ones as
well as the missing ones.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit speeds up the tests in `tor-dirserver` by using
functionality from Tokio's `test-util`.
Most notably, it runs the time intensive test in paused mode, which
means that the clock gets advanced either explicitly or implicitly using
auto-advance in case the runtime has nothing to do.
In our case, the last one, auto-advancing, is used, leading to our
sleep calls returning immediately.
This is good enough for testing in this module. It is not the
responsibility of tor-dirserver to ensure whether `RetryDelay` returns
proper values, as this is the responsibility of `tor-basic-utils`.
Still, it is a bit unfortunate that Tokio offers no way to manually
disbale the auto-advancing. In the future, it might be useful to
migrate more parts of this to crate to `tor-rtcompat`, but for now, this
change is a good enough performance fix.
|
| |
|
|
|
|
|
|
|
|
| |
This commit removes `mirror::download::test::request_fail_timeout` which
takes more than five seconds (due to a timeout) and is generally
ineffective in what it does, because testing whether a task is still
sleeping after a certain time is not super trivial with the tools Tokio
offers.
All this test offers is testing that we enter a timeout at all.
|
| |
|
|
|
|
|
| |
SQLite does not support u64 and the new version of SQLite makes a
certain piece of tor-dirserver no longer compile due to the lack of
`ToSql` for `u64`. This commit fixes it by converting these types from
`u64` to `i64` saturatingly.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
This commit replaces `AuthorityCommunicationError::IO` with
`AuthorityCommunicationError::TcpConnect` while removing the respective
`From<std::io::Error>` implementation, mostly because an IO error is way
too generic and in our case, it would only occurr with a failed TCP
connection.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
This commit implements the DownloadManager in its own module, an object
responsible for downloading network documents from an upstream directory
authority.
Further motivation for this can be found in the rustdoc comment of the
respectively introduced type.
|
| |
|
|
|
|
|
|
|
|
| |
This commit improves upon the work made in arti!3460, by establishing
the `database::Timestamp` type as a general purpose type for the
handling of timestamp throughout the code base.
It also replaces all previous occurrences of `SystemTime` within
`dirmirror::operation`, which leads to the reduction of code complexity
in one particular function, namely `calculate_sync_timeout`.
|
| | |
|
| |
|
|
|
|
|
| |
This commit replaces the custom implementation of `SaturatingSystemTime`
with the `saturating-time` crate, additionally adding a new type to the
`database` module called `Timestamp`, in order to have a convenient
wrapper around `ToSql` and `FromSql`.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit refactors `get_recent_consensus()` in `tor-dirserver` to use
a single SQL statement with the power of `INNER JOIN` instead of two SQL
statements querying the store after retrieving the SHA256 hash.
The primary motivation for this is to have cleaner code.
A single SQL statement is often-times easier to comprehend, as well more
performant in execution, although that can only be proven with a
profiler and is not of much concern, given that this function is only
executed roughly every 60-90min.
|
| |
|
|
|
|
| |
This commit changes various things in the dirmirror operation, namely
the use of a SystemTime wrapper type that provides saturation on both
ends.
|
| |
|
|
|
|
|
|
|
|
| |
This commit makes the entire database operations synchronous, thereby
replacing deadpool with r2d2.
The full motivation is outlined in a rustdoc comment at the top of the
`database` module, but it can be summarized to the fact that SQLite is
by design inherently synchronous due to directly interfacing with the
file system.
|
| |
|
|
|
|
|
|
|
|
| |
This commit creates a function named `mirror::operation::serve`, that
will serve as the primary entry point for the dirmirror operation.
While the function itself already contains some logic, such as querying
the timeout to wait for the next consensus, it is largely a rustdoc
design document that adds lots of comment to the `mirror::operation`
module.
|
|
|
This commit starts work in the `mirror::operation` module by
implementing the functions for calculating the `Duration` to wait from a
given `SystemTime` until the point in time when the dirmirror should
download new documents from the authorities again.
Also, this commit introduces new error types and internal helper
functions in order to fulfill this purpose better.
|