Skip to content

Commit

Permalink
checkin work
Browse files Browse the repository at this point in the history
  • Loading branch information
darioalessandro committed Jul 26, 2024
1 parent d724f63 commit c84dc62
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

12 changes: 7 additions & 5 deletions actix-api/src/webtransport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ where

let specific_subject_clone = specific_subject.clone();

let nats_task = {
let nats_receive_task = {
let session = session.clone();
let should_run = should_run.clone();
tokio::spawn(async move {
Expand Down Expand Up @@ -351,9 +351,11 @@ where
if let Err(e) = uni_stream.read_to_end(&mut buf).await {
error!("Error reading from unidirectional stream: {}", e);
}
if let Err(e) = nc.publish(specific_subject.clone(), buf.into()).await {
error!("Error publishing to subject {}: {}", &specific_subject, e);
}
tokio::spawn(async move {
if let Err(e) = nc.publish(specific_subject.clone(), buf.into()).await {
error!("Error publishing to subject {}: {}", &specific_subject, e);
}
});
});
}
}
Expand All @@ -375,7 +377,7 @@ where
};
quic_task.await?;
should_run.store(false, Ordering::SeqCst);
nats_task.abort();
nats_receive_task.abort();
info!("Finished handling session");
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion helm/rustlemania-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replicaCount: 1
image:
repository: securityunion/rustlemania-ui
pullPolicy: Always
tag: fix-webtransport-434d4ca8
tag: fix-webtransport-92cbac9c
resources:
limits:
cpu: "50m" # 50% of a single CPU
Expand Down
10 changes: 10 additions & 0 deletions log_ssl_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

export SSLKEYLOGFILE="/tmp/tmp-google/ssl_keys.log"

case $(uname) in
(*Linux*) google-chrome;;
(*Darwin*) open -a "Google Chrome" --args --user-data-dir="/tmp/tmp-google" --enable-logging --v=1 ;;
esac
2 changes: 1 addition & 1 deletion videocall-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wasm-bindgen = "0.2.78"
wasm-bindgen-futures = "0.4.30"
yew = { version = "0.21" }
yew-websocket = "1.21.0"
yew-webtransport = {git = "https://github.com/security-union/yew-webtransport.git", rev = "96e21cae267c92ba3f5fa8169c1cb6f9b9dc3b1c" }
yew-webtransport = {git = "https://github.com/security-union/yew-webtransport.git", rev = "ea5b757a483c4af524395cf24c468e85520b6e98" }

[dependencies.web-sys]
version = "0.3.60"
Expand Down
8 changes: 5 additions & 3 deletions videocall-client/src/client/video_call_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use log::{debug, error, info};
use protobuf::Message;
use rsa::pkcs8::{DecodePublicKey, EncodePublicKey};
use rsa::RsaPublicKey;
use wasm_bindgen::JsValue;
use std::cell::RefCell;
use std::rc::{Rc, Weak};
use types::protos::aes_packet::AesPacket;
use types::protos::media_packet::media_packet::MediaType;
use types::protos::packet_wrapper::packet_wrapper::PacketType;
use types::protos::packet_wrapper::PacketWrapper;
use types::protos::rsa_packet::RsaPacket;
use wasm_bindgen::JsValue;
use yew::prelude::Callback;

/// Options struct for constructing a client via [VideoCallClient::new(options)][VideoCallClient::new]
Expand Down Expand Up @@ -177,10 +177,11 @@ impl VideoCallClient {
match inner.try_borrow_mut() {
Ok(mut inner) => {
inner.peer_decode_manager.run_peer_monitor();
// on_connection_lost.emit(());
}
Err(_) => {
error!("Unable to borrow inner -- not starting peer monitor");
on_connection_lost.emit(JsValue::from_str(
"Unable to borrow inner -- not starting peer monitor",
));
}
}
}
Expand All @@ -202,6 +203,7 @@ impl VideoCallClient {
options,
self.aes.clone(),
)?);
info!("Connected to server");
Ok(())
}

Expand Down
8 changes: 6 additions & 2 deletions videocall-client/src/connection/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ impl WebMedia<WebSocketTask> for WebSocketTask {
fn connect(options: ConnectOptions) -> anyhow::Result<WebSocketTask> {
let notification = Callback::from(move |status| match status {
WebSocketStatus::Opened => options.on_connected.emit(()),
WebSocketStatus::Closed => options.on_connection_lost.emit(JsValue::from_str("WebSocket closed")),
WebSocketStatus::Error => options.on_connection_lost.emit(JsValue::from_str("WebSocket error")),
WebSocketStatus::Closed => options
.on_connection_lost
.emit(JsValue::from_str("WebSocket closed")),
WebSocketStatus::Error => options
.on_connection_lost
.emit(JsValue::from_str("WebSocket error")),
});
debug!("WebSocket connecting to {}", &options.websocket_url);
let task = WebSocketService::connect(
Expand Down
13 changes: 5 additions & 8 deletions videocall-client/src/connection/webtransport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use js_sys::Reflect;
use js_sys::Uint8Array;
use log::debug;
use log::error;
use log::info;
use protobuf::Message;
use types::protos::packet_wrapper::PacketWrapper;
use wasm_bindgen::JsCast;
Expand Down Expand Up @@ -57,23 +58,19 @@ impl WebMedia<WebTransportTask> for WebTransportTask {
let connection_lost_callback = options.on_connection_lost.clone();
Callback::from(move |status| match status {
WebTransportStatus::Opened => connected_callback.emit(()),
WebTransportStatus::Closed(error) => {
connection_lost_callback.emit(error)
},
WebTransportStatus::Error(error) => {
connection_lost_callback.emit(error)
}
WebTransportStatus::Closed(error) => connection_lost_callback.emit(error),
WebTransportStatus::Error(error) => connection_lost_callback.emit(error),
})
};
debug!("WebTransport connecting to {}", &options.webtransport_url);
info!("WebTransport connecting to {}", &options.webtransport_url);
let task = WebTransportService::connect(
&options.webtransport_url,
on_datagram,
on_unidirectional_stream,
on_bidirectional_stream,
notification,
)?;
debug!("WebTransport connection success");
info!("WebTransport connection success");
Ok(task)
}

Expand Down
2 changes: 1 addition & 1 deletion yew-ui/Cargo.lock

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

6 changes: 5 additions & 1 deletion yew-ui/src/components/attendants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ pub enum MeetingAction {
ToggleVideoOnOff,
}

#[derive(Debug)]
pub enum UserScreenAction {
TogglePeerList,
}

#[derive(Debug)]
pub enum Msg {
WsAction(WsAction),
MeetingAction(MeetingAction),
Expand Down Expand Up @@ -153,7 +155,8 @@ impl Component for AttendantsComponent {
}
}

fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
log::info!("AttendantsComponent update: {:?}", msg);
match msg {
Msg::WsAction(action) => match action {
WsAction::Connect => {
Expand All @@ -164,6 +167,7 @@ impl Component for AttendantsComponent {
ctx.link()
.send_message(WsAction::Log(format!("Connection failed: {e}")));
}
log::info!("Connected in attendants");
true
}
WsAction::Connected => true,
Expand Down

0 comments on commit c84dc62

Please sign in to comment.