Browse Source

fix transition bugs in server

master
Erik Zscheile 3 years ago
parent
commit
4b170b6b6a
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      server/src/main.rs

+ 5
- 2
server/src/main.rs View File

@ -108,8 +108,8 @@ fn main() -> io::Result<()> {
outputs.insert(origin, wr);
}
DistrInner::Message(mut msg) => {
msg = format!("{}: {}\n", origin.to_string(), msg);
print!("{}", msg);
msg = format!("{}: {}", origin.to_string(), msg);
println!("{}", msg);
let mut new_outputs = HashMap::new();
new_outputs.reserve(outputs.len());
for (k, mut v) in std::mem::take(&mut outputs) {
@ -141,6 +141,9 @@ fn main() -> io::Result<()> {
println!("Connected: {}", peer_addr);
distr_send(&distr_in, peer_addr, DistrInner::Connect(writer));
while let Ok(blob) = zsittle::read_blob(&mut reader).await {
if blob.data.is_empty() {
break;
}
if let Ok(line) = std::str::from_utf8(&blob.data[..]) {
distr_send(&distr_in, peer_addr, DistrInner::Message(line.to_string()));
}


Loading…
Cancel
Save