Merge branch 'main' of github.com:gruberb/protohackers-rs into main
This commit is contained in:
commit
6ef6cb5b4b
1 changed files with 16 additions and 11 deletions
|
|
@ -57,6 +57,7 @@ async fn main() -> Result<()> {
|
|||
// we won't process until we find one.
|
||||
match framed.next().await {
|
||||
Some(Ok(username)) => {
|
||||
if !username.is_empty() && username.is_ascii() {
|
||||
name = username.clone();
|
||||
db.0.lock().unwrap().insert(username.clone(), address);
|
||||
let message = compose_message(username.clone(), db.clone());
|
||||
|
|
@ -68,6 +69,10 @@ async fn main() -> Result<()> {
|
|||
format!("* {} has entered the room", username),
|
||||
);
|
||||
let _ = tx.send(b);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
Some(Err(e)) => {
|
||||
error!("Error parsing message: {e}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue