summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* ChanMgr: move the AbstractChanFactory into MgrState.Nick Mathewson2022-11-221-3/+3
| | | | | | We will want the freedom to replace this, so it needs to go behind a lock. We need to be able to Clone it cheaply now, so we're using an Arc instead of a Box.
* Replace TransportRegistry with AbstractPtMgreta2022-11-221-3/+3
| | | | | | | | | | | | | | | | | | It doesn't make much sense to have the pluggable transport manager be a registry, so replace its interface with a more narrowly defined, less generic version. Other changes: - instead of returning a &-reference, it returns an owned Arc, which should make the ptmgr easier to implement while allowing efficient reuse - provision for error handling is added, but will probably be revised in a future commit pending discussion - tor-ptmgr code that would generate warnings as a result of this change is temporarily removed This is a split out version of arti!886, intended so work on arti#659 can proceed.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* chanmgr: Remove "Ident" from AbstractChannelNick Mathewson2022-10-181-10/+1
| | | | | Thanks to our previous changes, we no longer need this type, or the methods that access it.
* ChanMgr: Reorganize factory, builder, transport code.Nick Mathewson2022-10-131-1/+2
| | | | There is no actual code change here: just movement.
* Merge branch 'factory_redux' into 'main'Nick Mathewson2022-10-131-5/+20
|\ | | | | | | | | chanmgr: Build and use chanmgr factory APIs See merge request tpo/core/arti!769
| * Flatten TimeoutChannelFactory into ChannelBuilder.Nick Mathewson2022-10-131-2/+1
| |
| * chanmgr: clean up some TODO pt-client items and documentation.Nick Mathewson2022-10-131-2/+5
| |
| * Allow multiple ChannelBuilders to share a ChanMgrEventSender.Nick Mathewson2022-10-131-0/+1
| |
| * chanmgr: Use ChannelFactory via a Box<dyn<ChannelFactory>>.Nick Mathewson2022-10-131-4/+12
| | | | | | | | | | This will prepare for supporting multiple different ChannelFactory implementations.
| * chanmgr: Move Timeout functionality into a decorator object.Nick Mathewson2022-10-131-2/+5
| |
| * Have ChannelBuilder use TransportHelper.Nick Mathewson2022-10-131-2/+3
| | | | | | | | | | | | This lets us build channels using different TransportHelpers, including the (new) default TransportHelper, which just uses the old connect_to_one() code.
* | cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | | | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
* | Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-33/+1
|/ | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* Mark all bridge and pt features as experimental for now.Nick Mathewson2022-09-291-0/+17
| | | | | | Also, document the features. Closes #588.