Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
alepez committed May 22, 2023
1 parent d8be10d commit d0617f7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/collab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ impl Room {
let peers: Vec<_> = self.socket.connected_peers().collect();
let mut payload = Vec::new();
ciborium::ser::into_writer(&event, &mut payload).unwrap();
info!("TX bytes: {}", payload.len());
for peer in peers {
self.socket.send(payload.clone().into(), peer);
}
Expand All @@ -170,7 +169,6 @@ impl Room {
.iter()
.map(|(_, payload)| payload)
.filter_map(|payload| ciborium::de::from_reader(&payload[..]).ok())
.inspect(|event| info!("RX {:?}", event))
.collect()
}

Expand All @@ -179,28 +177,28 @@ impl Room {
}
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
#[derive(Serialize, Deserialize, Copy, Clone)]
enum Event {
Draw(DrawEvent),
Release,
Clear,
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
#[derive(Serialize, Deserialize, Copy, Clone)]
struct DrawEvent {
color: u32,
line_width: u8,
x: i16,
y: i16,
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
#[derive(Serialize, Deserialize, Copy, Clone)]
struct AddressedEvent {
src: CollabId,
event: Event,
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Serialize, Deserialize, Copy, Clone, PartialEq, Eq, Hash)]
struct CollabId(u16);

impl From<u16> for CollabId {
Expand Down

0 comments on commit d0617f7

Please sign in to comment.