summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* tor-chanmgr: add `util::defer` moduleSteven Engler2024-11-271-0/+1
| | | | | This contains the `Defer` type, which can be used to defer a closure until the `Defer` is dropped.
* tor-chanmgr: fix reconfigure bug when given `CheckAllOrNothing`Steven Engler2024-11-121-2/+9
| | | | We shouldn't actually reconfigure anything if given `CheckAllOrNothing`.
* tor-chanmgr: fix `unused_imports` warning on `ChannelAccount`Steven Engler2024-10-091-1/+3
|
* tor-proto: Make circuit->channel queues participate in memquotaIan Jackson2024-10-031-1/+12
| | | | | | | | We use the *channel*'s memquota account. This is arguably wrong, but it's hard to get right now. See #1652. Change the type of the queue, and the places it's constructed. The use sites can all stay the same.
* tor-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-031-2/+3
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* memquota: Add a toplevel account in tor-chanmgrIan Jackson2024-10-031-1/+6
| | | | | | | | | Plumb through a top-level account. This doesn't have any channel-specific, circuit-specific or stream-specific accounts yet. tor-circmgr's and tor-hsclient's *tests* need fake account. In arti-relay, use a dummy account for now.
* memquota: Add a toplevel account in tor-chanmgr (pre-fmt)Ian Jackson2024-10-031-1/+2
|
* tor-proto: Reformat a doc commentIan Jackson2024-09-261-3/+6
| | | | | | Make it have a summary line of only reasonable size. While we're here, wrap the body with semantic linefeeds.
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-1/+1
| | | | | | | | | | | | | | (And similarly rename TcpListener to NetStreamListener, along with their TcpStream/TcpListener associated types.) These types are about to become generic over addresses, and therefore shouldn't be named after TCP. Renaming was done mostly with Rust Analyzer, except for some macros that needed to be hand-edited. (I'll revise the comments in the next commit; this one is all about renaming.)
* tor-chanmgr: add experimental `ChanMgr::handle_incoming`Steven Engler2024-09-111-0/+13
| | | | | | | | | The channel manager in the future will need to be able to receive incoming streams. The type of the stream depends on an associated type within `ChannelFactory`, so this commit exposes this associated type through several other types, eventually to the `ChanMgr`. The new methods are behind the experimental "relay" feature flag.
* tor-chanmgr: make `CompoundFactory` generic over `ChannelFactory`Steven Engler2024-09-111-2/+6
| | | | | | | | | | This has two advantages: 1. Code is a little easier to follow with generics rather than dynamic dispatch, especially since the type is fixed at compile time anyways. 2. It allows us to access associated types of the `ChannelFactory`, which will be useful later for getting the stream type from the `ChanBuilder`.
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-161-2/+2
| | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* educe: Use std's default for enums where default variant is unitIan Jackson2024-02-121-4/+2
| | | | | | | | | | | | | Since Rust 1.66, std's default works properly for enums, provided that the default variant is a unit. Review all uses of `#[educe(default)]` on enums and replace them with std where possible, which is most of them. In 1.66 and later, std's `#[derive(Default)]` doesn't infer any generic bounds on the derived impl, where it's an enum - since the unit variant can always be constructed. So this change doesn't add any generic bounds and is not API-visible.
* continually_expire_channels: don't round off expiration delayJim Newsome2023-12-131-1/+1
| | | | | | | | | Without this change, if the delay is less than one second, the code will effectively busy-loop until the delay has elapsed. This potentially leads to deadlock in shadow simulations, and wastes CPU in real usage. https://shadow.github.io/docs/guide/limitations.html?highlight=busy#busy-loops
* continually_expire_channels: refactor using let-elseJim Newsome2023-12-131-3/+2
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Fix a pair of rustdoc links in chanmgr.Nick Mathewson2023-07-191-2/+2
|
* Move an import to resolve a warning.Nick Mathewson2023-07-131-1/+2
|
* Explain better why you would use build_unmanaged_channelNick Mathewson2023-07-131-2/+7
|
* Resolve numerous typos in `ChanMgr::build_unmanaged_channel` codegabi-2502023-07-131-4/+4
|
* chanmgr: Remove now-unused (and never usable) builder() method.Nick Mathewson2023-07-131-12/+0
|
* chanmgr: Document makeup and timeout behavior of our factoriesNick Mathewson2023-07-131-0/+22
| | | | | Basically, it's all ChanBuilder at some point, and ChanBuilder has a timeout.
* chanmgr: Add an experimental build_unmanaged_channel() method.Nick Mathewson2023-07-131-0/+26
| | | | | This method will let the user construct a channel that isn't stored or monitored by the ChanMgr.
* Gate builder() behind experimental-api featureSaksham Mittal2023-07-121-1/+1
|
* Merge branch 'channelfactory' into 'main'Nick Mathewson2023-07-121-1/+7
|\ | | | | | | | | Expose channel builder in order to create channels more efficiently in external code See merge request tpo/core/arti!1374
| * Mark builder() as experimentalSaksham Mittal2023-07-061-0/+1
| |
| * Import ChannelFactory instead of CompoundFactorySaksham Mittal2023-07-061-3/+3
| |
| * Rename get_channelbuilder() to builder()Saksham Mittal2023-07-061-1/+1
| |
| * Remove now unnecessary lines for importSaksham Mittal2023-07-051-2/+0
| |
| * Import CompoundFactory regardless of feature levelSaksham Mittal2023-07-051-3/+1
| |
| * Create new method to expose CompoundFactorySaksham Mittal2023-07-051-0/+9
| |
* | Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
| |
* | Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-071-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I identified the cases to replace by searching for the string `.report()`. There are a few that I didn't change: * A couple of cases that used anyhow::Error, * One case that reported two Errors. * Two cases in `tor_hsclient::err` that just did `error!("Bug: {}")`. I have also not audited the cases in `tor-hsclient` where we're using `tor_error::Report` manually. Nonetheless, closes #949.
* | Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
|/ | | | Closes #950.
* ChanMgr: Tweak documentation a bit.Nick Mathewson2023-06-281-9/+13
| | | | | Adjust formatting, add more references to lower-level APIs, and clarify lifetimes a little more.
* Add Channel expiry info in ChanMgr docsSaksham Mittal2023-06-271-0/+7
|
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* Use ErrorReport for errors in error! in tor-chanmgrIan Jackson2023-01-301-2/+3
|
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Abolish ChanMgr::set_default_transportIan Jackson2022-11-301-13/+0
| | | | | | The comment says // TODO pt-client: It's not clear to me that we really need this method. and empirically, deleting it, and its callee, is fine.
* Fix ChanMgr APIs for setting PtMgr etc to match what TorClient wants.Nick Mathewson2022-11-281-7/+4
|
* tor-chanmgr: Introduce the BootstrapReporter API, publicize ChanBuildereta2022-11-281-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | This commit makes the `ChanBuilder` type in `tor-chanmgr` usable by consumers outside of that crate, like the doc comment for `ChannelFactory` says you need to be able to do in order to turn your `TransportHelper` into something useful. As part of doing this, the `event_sender` its constructor takes needed to be dealt with, since it was a crate-internal type that came from inside the `ChanMgr`. Enter `BootstrapReporter`: an opaque wrapper around that sender, now provided as an additional argument to `ChannelFactory::connect_via_transport`. You can now construct a `ChanBuilder` outside this crate, and it'll still be able to report its bootstrap status by unwrapping this new type that's threaded through from the `ChanMgr`. (This was a fair deal of manually threading the type through all the layers in this crate!) Note that you cannot implement bootstrap updating using something that isn't `ChanBuilder` yet due to the type being entirely opaque (but, of course, we can figure out exactly what API the reporter should have later, and add that capability in).
* ChanMgr: Rename Factory -> CompoundFactoryNick Mathewson2022-11-231-2/+2
|
* Mark set-default-factory API as experimental.Nick Mathewson2022-11-231-4/+2
|
* Make ChannelFactory and AbstractPtMgr require Send+SyncNick Mathewson2022-11-231-1/+1
|
* ChanMgr: Implement functions that replace channel factories.Nick Mathewson2022-11-231-15/+20
| | | | | | | This commit makes it possible to replace the default channel factory (used when there is no PtMgr), and to replace the PtMgr. This is part of #659.