Skip to content

Commit

Permalink
protocols/noise: Return pinned future on authenticated noise upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Sep 26, 2019
1 parent ef103c9 commit 7df47f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions protocols/noise/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ where
{
type Output = (PeerId, NoiseOutput<Negotiated<T>>);
type Error = NoiseError;
type Future = Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Unpin>;
type Future = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>>>>;

fn upgrade_inbound(self, socket: Negotiated<T>, info: Self::Info) -> Self::Future {
Box::new(self.config.upgrade_inbound(socket, info)
Box::pin(self.config.upgrade_inbound(socket, info)
.and_then(|(remote, io)| match remote {
RemoteIdentity::IdentityKey(pk) => future::ok((pk.into_peer_id(), io)),
_ => future::err(NoiseError::AuthenticationFailed)
Expand All @@ -350,10 +350,10 @@ where
{
type Output = (PeerId, NoiseOutput<Negotiated<T>>);
type Error = NoiseError;
type Future = Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Unpin>;
type Future = Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>>>>;

fn upgrade_outbound(self, socket: Negotiated<T>, info: Self::Info) -> Self::Future {
Box::new(self.config.upgrade_outbound(socket, info)
Box::pin(self.config.upgrade_outbound(socket, info)
.and_then(|(remote, io)| match remote {
RemoteIdentity::IdentityKey(pk) => future::ok((pk.into_peer_id(), io)),
_ => future::err(NoiseError::AuthenticationFailed)
Expand Down

0 comments on commit 7df47f0

Please sign in to comment.