Commit d208c062 authored by Nick Mathewson's avatar Nick Mathewson 🥔
Browse files

hss: Remove OnionServiceDataStram type.

I think that the reason we added this was in case we needed
different behavior from DataStream; but on reflection it does seem
that we don't.  Having a single type here will make things a bit
simpler.
parent 8840dfb7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ pub use config::OnionServiceConfig;
pub use err::{ClientError, EstablishSessionError, FatalError, IntroRequestError, StartupError};
pub use keys::{HsSvcKeyRole, HsSvcKeySpecifier};
pub use nickname::{HsNickname, InvalidNickname};
pub use req::{OnionServiceDataStream, RendRequest, StreamRequest};
pub use req::{RendRequest, StreamRequest};
pub use status::OnionServiceStatus;
pub use svc::OnionService;

+3 −17
Original line number Diff line number Diff line
@@ -89,15 +89,6 @@ pub struct StreamRequest {
    on_circuit: Arc<ClientCirc>,
}

/// A stream opened over an onion service.
//
// TODO HSS: This may belong in another module.
#[derive(Debug)]
pub struct OnionServiceDataStream {
    /// The underlying data stream; this type is just a thin wrapper.
    inner: DataStream,
}

/// Keys and objects needed to answer a RendRequest.
pub(crate) struct RendRequestContext {
    /// Keys we'll use to decrypt the rendezvous request.
@@ -192,16 +183,11 @@ impl StreamRequest {
    }

    /// Accept this request and send the client a `CONNECTED` message.
    pub async fn accept(
        self,
        connected_message: Connected,
    ) -> Result<OnionServiceDataStream, ClientError> {
        let stream = self
            .stream
    pub async fn accept(self, connected_message: Connected) -> Result<DataStream, ClientError> {
        self.stream
            .accept_data(connected_message)
            .await
            .map_err(ClientError::AcceptStream)?;
        Ok(OnionServiceDataStream { inner: stream })
            .map_err(ClientError::AcceptStream)
    }
    /// Reject this request, and send the client an `END` message.
    /// TODO HSS: Should this really be fallible?  How might it fail?