Skip to content

Commit 8ae3595

Browse files
committed
Allow changing certificate at runtime
1 parent 59b4b19 commit 8ae3595

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
use futures_util::stream::{FuturesUnordered, Stream, StreamExt};
1818
use pin_project_lite::pin_project;
1919
use std::future::Future;
20-
use std::io;
2120
use std::marker::Unpin;
2221
use std::pin::Pin;
2322
use std::task::{Context, Poll};
2423
use std::time::Duration;
24+
use std::{io, mem};
2525
use thiserror::Error;
2626
use tokio::io::{AsyncRead, AsyncWrite};
2727
use tokio::time::{timeout, Timeout};
@@ -136,6 +136,13 @@ where
136136
pub fn accept(&mut self) -> impl Future<Output = Option<<Self as Stream>::Item>> + '_ {
137137
self.next()
138138
}
139+
140+
/// Replaces the Tls Acceptor configuration, which will be used for new connections.
141+
///
142+
/// This can be used to change the certificate used at runtime.
143+
pub fn replace_acceptor(&mut self, acceptor: T) {
144+
self.tls = acceptor;
145+
}
139146
}
140147

141148
impl<A, T> Stream for TlsListener<A, T>

0 commit comments

Comments
 (0)