hsclient: Use HsDescDownloadRequest::set_max_len.

This commit is contained in:
Nick Mathewson 2023-06-27 16:17:37 -04:00
parent 32e3cde3fd
commit 4692dba5e0
1 changed files with 12 additions and 1 deletions

View File

@ -507,7 +507,18 @@ impl<'c, R: Runtime, M: MocksForConnect<R>> Context<'c, R, M> {
&self,
hsdir: &Relay<'_>,
) -> Result<TimerangeBound<HsDesc>, DescriptorErrorDetail> {
let request = tor_dirclient::request::HsDescDownloadRequest::new(self.hs_blind_id);
let max_len: usize = self
.netdir
.params()
.hsdir_max_desc_size
.get()
.try_into()
.map_err(into_internal!("BoundedInt was not truly bounded!"))?;
let request = {
let mut r = tor_dirclient::request::HsDescDownloadRequest::new(self.hs_blind_id);
r.set_max_len(max_len);
r
};
trace!(
"hsdir for {}, trying {}/{}, request {:?} (http request {:?}",
&self.hsid,