MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / tls_accept

Method tls_accept

gateway/src/proxy/tls_terminate.rs:247–271  ·  view source on GitHub ↗
(
        &self,
        inbound: TcpStream,
        buffer: Vec<u8>,
        h2: bool,
    )

Source from the content-addressed store, hash-verified

245 }
246
247 async fn tls_accept(
248 &self,
249 inbound: TcpStream,
250 buffer: Vec<u8>,
251 h2: bool,
252 ) -> Result<TlsStream<MergedStream>> {
253 let stream = MergedStream {
254 buffer,
255 buffer_cursor: 0,
256 inbound,
257 };
258 let acceptor = if h2 {
259 &self.h2_acceptor
260 } else {
261 &self.acceptor
262 };
263 let tls_stream = timeout(
264 self.config.proxy.timeouts.handshake,
265 acceptor.accept(stream),
266 )
267 .await
268 .context("handshake timeout")?
269 .context("failed to accept tls connection")?;
270 Ok(tls_stream)
271 }
272
273 pub(super) async fn proxy(
274 &self,

Callers 3

handle_this_nodeMethod · 0.80
handle_health_checkMethod · 0.80
proxyMethod · 0.80

Calls 1

acceptMethod · 0.45

Tested by

no test coverage detected