Skip to content

Commit

Permalink
Bump tokio-tungstenite from 0.24.0 to 0.26.1 (#40)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vikrant Chaudhary <[email protected]>
  • Loading branch information
dependabot[bot] and nasa42 authored Dec 24, 2024
1 parent e69e57c commit 6b89496
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 19 deletions.
64 changes: 57 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ flatbuffers = "24.3.25"
futures = "0.3.31"
pty-process = { version = "0.4.0", features = ["async"] }
tokio = "1.42.0"
tokio-tungstenite = "0.24.0"
tokio-tungstenite = "0.26.1"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
webterm-core = { path = "../core" }
Expand Down
7 changes: 4 additions & 3 deletions agent/src/models/agent_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fmt;
use tokio::sync::broadcast::error::RecvError;
use tokio::sync::mpsc::error::SendError;
use tokio_tungstenite::tungstenite;
use tokio_tungstenite::tungstenite::Bytes;
use webterm_core::models::reader_socket_error::ReaderSocketError;
use webterm_core::models::webterm_error::WebtermError;
use webterm_core::types::{ActivityId, FrontendId, SessionId};
Expand All @@ -14,7 +15,7 @@ pub enum AgentError {
FBParseError(String),
SocketError(tungstenite::Error),
SocketClosed,
SocketSendError(SendError<Vec<u8>>),
SocketSendError(SendError<Bytes>),
SocketRecvError(RecvError),
SocketReadError(ReaderSocketError),
PtyProcessError(pty_process::Error),
Expand Down Expand Up @@ -56,8 +57,8 @@ impl From<InvalidFlatbuffer> for AgentError {
}
}

impl From<SendError<Vec<u8>>> for AgentError {
fn from(err: SendError<Vec<u8>>) -> Self {
impl From<SendError<Bytes>> for AgentError {
fn from(err: SendError<Bytes>) -> Self {
AgentError::SocketSendError(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion agent/src/models/send_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl SendPayload {
pub async fn dispatch(self, relay_pub: &SocketPublisher) -> Result<(), AgentError> {
if let Some(payload) = self.to_relay {
// debug!("dispatching to relay");
relay_pub.send(payload.0).await?;
relay_pub.send(payload.0.into()).await?;
}

if let Some((activity, data)) = self.to_activity {
Expand Down
8 changes: 4 additions & 4 deletions agent/src/models/socket_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ use futures::StreamExt;
use std::sync::Arc;
use tokio::net::TcpStream;
use tokio::sync::broadcast;
use tokio_tungstenite::tungstenite::Message;
use tokio_tungstenite::tungstenite::{Bytes, Message};
use tokio_tungstenite::{MaybeTlsStream, WebSocketStream};
use tracing::{error, info};
use webterm_core::models::reader_socket_error::ReaderSocketError;

pub type SocketSubscriber = broadcast::Receiver<Result<Option<Vec<u8>>, ReaderSocketError>>;
pub type SocketSubscriber = broadcast::Receiver<Result<Option<Bytes>, ReaderSocketError>>;

pub struct SocketReader {
_tx: broadcast::Sender<Result<Option<Vec<u8>>, ReaderSocketError>>,
_tx: broadcast::Sender<Result<Option<Bytes>, ReaderSocketError>>,
}

impl SocketReader {
pub fn new(
mut reader_stream: SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
rc: Arc<RelayConnection>,
) -> Self {
let (_tx, _rx) = broadcast::channel::<Result<Option<Vec<u8>>, ReaderSocketError>>(16);
let (_tx, _rx) = broadcast::channel::<Result<Option<Bytes>, ReaderSocketError>>(16);
let tx = _tx.clone();
let rc_clone = rc.clone();

Expand Down
6 changes: 3 additions & 3 deletions agent/src/models/socket_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use futures::SinkExt;
use std::sync::Arc;
use tokio::net::TcpStream;
use tokio::sync::mpsc;
use tokio_tungstenite::tungstenite::Message;
use tokio_tungstenite::tungstenite::{Bytes, Message};
use tokio_tungstenite::{MaybeTlsStream, WebSocketStream};
use tracing::info;

pub type SocketPublisher = mpsc::Sender<Vec<u8>>;
pub type SocketPublisher = mpsc::Sender<Bytes>;

pub struct SocketWriter {
_tx: SocketPublisher,
Expand All @@ -20,7 +20,7 @@ impl SocketWriter {
mut writer_stream: SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>,
rc: Arc<RelayConnection>,
) -> Self {
let (_tx, mut rx) = mpsc::channel::<Vec<u8>>(16);
let (_tx, mut rx) = mpsc::channel::<Bytes>(16);
let rc_clone = rc.clone();

tokio::spawn(async move {
Expand Down

0 comments on commit 6b89496

Please sign in to comment.