Skip to content

Commit

Permalink
back-out rustls changes in favor of #1367
Browse files Browse the repository at this point in the history
  • Loading branch information
olix0r committed Nov 8, 2021
1 parent 92d4eb9 commit eb77991
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
25 changes: 16 additions & 9 deletions linkerd/meshtls/rustls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use futures::prelude::*;
use linkerd_io as io;
use linkerd_stack::{NewService, Service};
use linkerd_tls::{client::AlpnProtocols, ClientTls, HasNegotiatedProtocol, NegotiatedProtocolRef};
use std::{pin::Pin, sync::Arc, task::Context};
use std::{pin::Pin, sync::Arc};
use tokio::sync::watch;
use tokio_rustls::rustls::{ClientConfig, Session};

Expand Down Expand Up @@ -84,8 +84,11 @@ where
type Error = io::Error;
type Future = ConnectFuture<I>;

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> io::Poll<()> {
io::Poll::Ready(Ok(()))
fn poll_ready(
&mut self,
_cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Result<(), Self::Error>> {
std::task::Poll::Ready(Ok(()))
}

fn call(&mut self, io: I) -> Self::Future {
Expand All @@ -101,7 +104,7 @@ impl<I: io::AsyncRead + io::AsyncWrite + Unpin> io::AsyncRead for ClientIo<I> {
#[inline]
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
cx: &mut std::task::Context<'_>,
buf: &mut io::ReadBuf<'_>,
) -> io::Poll<()> {
Pin::new(&mut self.0).poll_read(cx, buf)
Expand All @@ -110,26 +113,30 @@ impl<I: io::AsyncRead + io::AsyncWrite + Unpin> io::AsyncRead for ClientIo<I> {

impl<I: io::AsyncRead + io::AsyncWrite + Unpin> io::AsyncWrite for ClientIo<I> {
#[inline]
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> io::Poll<()> {
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> io::Poll<()> {
Pin::new(&mut self.0).poll_flush(cx)
}

#[inline]
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> io::Poll<()> {
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> io::Poll<()> {
Pin::new(&mut self.0).poll_shutdown(cx)
}

#[inline]
fn poll_write(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> io::Poll<usize> {
fn poll_write(
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buf: &[u8],
) -> io::Poll<usize> {
Pin::new(&mut self.0).poll_write(cx, buf)
}

#[inline]
fn poll_write_vectored(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
cx: &mut std::task::Context<'_>,
bufs: &[io::IoSlice<'_>],
) -> io::Poll<usize> {
) -> std::task::Poll<Result<usize, std::io::Error>> {
Pin::new(&mut self.0).poll_write_vectored(cx, bufs)
}

Expand Down
22 changes: 13 additions & 9 deletions linkerd/meshtls/rustls/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use linkerd_stack::{Param, Service};
use linkerd_tls::{
ClientId, HasNegotiatedProtocol, NegotiatedProtocol, NegotiatedProtocolRef, ServerTls,
};
use std::{pin::Pin, sync::Arc, task::Context};
use std::{pin::Pin, sync::Arc, task};
use thiserror::Error;
use tokio::sync::watch;
use tokio_rustls::rustls::{Certificate, ServerConfig, Session};
Expand Down Expand Up @@ -99,8 +99,8 @@ where
type Future = TerminateFuture<I>;

#[inline]
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> io::Poll<()> {
io::Poll::Ready(Ok(()))
fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> task::Poll<Result<(), Self::Error>> {
task::Poll::Ready(Ok(()))
}

#[inline]
Expand Down Expand Up @@ -152,7 +152,7 @@ impl<I: io::AsyncRead + io::AsyncWrite + Unpin> io::AsyncRead for ServerIo<I> {
#[inline]
fn poll_read(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
cx: &mut std::task::Context<'_>,
buf: &mut io::ReadBuf<'_>,
) -> io::Poll<()> {
Pin::new(&mut self.0).poll_read(cx, buf)
Expand All @@ -161,26 +161,30 @@ impl<I: io::AsyncRead + io::AsyncWrite + Unpin> io::AsyncRead for ServerIo<I> {

impl<I: io::AsyncRead + io::AsyncWrite + Unpin> io::AsyncWrite for ServerIo<I> {
#[inline]
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> io::Poll<()> {
fn poll_flush(mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> io::Poll<()> {
Pin::new(&mut self.0).poll_flush(cx)
}

#[inline]
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> io::Poll<()> {
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> io::Poll<()> {
Pin::new(&mut self.0).poll_shutdown(cx)
}

#[inline]
fn poll_write(mut self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> io::Poll<usize> {
fn poll_write(
mut self: Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buf: &[u8],
) -> io::Poll<usize> {
Pin::new(&mut self.0).poll_write(cx, buf)
}

#[inline]
fn poll_write_vectored(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
cx: &mut std::task::Context<'_>,
bufs: &[io::IoSlice<'_>],
) -> io::Poll<usize> {
) -> std::task::Poll<Result<usize, std::io::Error>> {
Pin::new(&mut self.0).poll_write_vectored(cx, bufs)
}

Expand Down

0 comments on commit eb77991

Please sign in to comment.