From 1976504c632c78aaadbf24dc94e8ce5626bce9f1 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 20 Apr 2023 21:54:22 +0530 Subject: refactor(ext/websocket): use fastwebsockets client (#18725) --- ext/http/lib.rs | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'ext/http/lib.rs') diff --git a/ext/http/lib.rs b/ext/http/lib.rs index 289e7bf0f..43e3c130a 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -1129,41 +1129,6 @@ async fn op_http_upgrade_early( Ok(rid) } -struct UpgradedStream(hyper::upgrade::Upgraded); -impl tokio::io::AsyncRead for UpgradedStream { - fn poll_read( - self: Pin<&mut Self>, - cx: &mut Context, - buf: &mut tokio::io::ReadBuf, - ) -> std::task::Poll> { - Pin::new(&mut self.get_mut().0).poll_read(cx, buf) - } -} - -impl tokio::io::AsyncWrite for UpgradedStream { - fn poll_write( - self: Pin<&mut Self>, - cx: &mut Context, - buf: &[u8], - ) -> std::task::Poll> { - Pin::new(&mut self.get_mut().0).poll_write(cx, buf) - } - fn poll_flush( - self: Pin<&mut Self>, - cx: &mut Context, - ) -> std::task::Poll> { - Pin::new(&mut self.get_mut().0).poll_flush(cx) - } - fn poll_shutdown( - self: Pin<&mut Self>, - cx: &mut Context, - ) -> std::task::Poll> { - Pin::new(&mut self.get_mut().0).poll_shutdown(cx) - } -} - -impl deno_websocket::Upgraded for UpgradedStream {} - #[op] async fn op_http_upgrade_websocket( state: Rc>, @@ -1183,9 +1148,7 @@ async fn op_http_upgrade_websocket( }; let transport = hyper::upgrade::on(request).await?; - let ws_rid = - ws_create_server_stream(&state, Box::pin(UpgradedStream(transport))) - .await?; + let ws_rid = ws_create_server_stream(&state, transport).await?; Ok(ws_rid) } -- cgit v1.2.3