mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
chore: fmt
This commit is contained in:
parent
a998ce8ed8
commit
a4c0cb22a9
@ -1,7 +1,7 @@
|
||||
//! This example shows how to use `actix_web::HttpServer::on_connect` to access client certificates
|
||||
//! pass them to a handler through connection-local data.
|
||||
|
||||
use std::{any::Any, sync::Arc, fs::File, io::BufReader, net::SocketAddr};
|
||||
use std::{any::Any, fs::File, io::BufReader, net::SocketAddr, sync::Arc};
|
||||
|
||||
use actix_tls::accept::rustls_0_21::{reexports::ServerConfig, TlsStream};
|
||||
use actix_web::{
|
||||
|
@ -128,10 +128,7 @@ impl ChatServer {
|
||||
self.sessions.insert(id, tx);
|
||||
|
||||
// auto join session to main room
|
||||
self.rooms
|
||||
.entry("main".to_owned())
|
||||
.or_default()
|
||||
.insert(id);
|
||||
self.rooms.entry("main".to_owned()).or_default().insert(id);
|
||||
|
||||
let count = self.visitor_count.fetch_add(1, Ordering::SeqCst);
|
||||
self.send_system_message("main", 0, format!("Total visitors {count}"))
|
||||
@ -185,10 +182,7 @@ impl ChatServer {
|
||||
.await;
|
||||
}
|
||||
|
||||
self.rooms
|
||||
.entry(room.clone())
|
||||
.or_default()
|
||||
.insert(conn_id);
|
||||
self.rooms.entry(room.clone()).or_default().insert(conn_id);
|
||||
|
||||
self.send_system_message(&room, conn_id, "Someone connected")
|
||||
.await;
|
||||
|
@ -129,10 +129,7 @@ impl Handler<Connect> for ChatServer {
|
||||
self.sessions.insert(id, msg.addr);
|
||||
|
||||
// auto join session to main room
|
||||
self.rooms
|
||||
.entry("main".to_owned())
|
||||
.or_default()
|
||||
.insert(id);
|
||||
self.rooms.entry("main".to_owned()).or_default().insert(id);
|
||||
|
||||
let count = self.visitor_count.fetch_add(1, Ordering::SeqCst);
|
||||
self.send_message("main", &format!("Total visitors {count}"), 0);
|
||||
@ -211,10 +208,7 @@ impl Handler<Join> for ChatServer {
|
||||
self.send_message(&room, "Someone disconnected", 0);
|
||||
}
|
||||
|
||||
self.rooms
|
||||
.entry(name.clone())
|
||||
.or_default()
|
||||
.insert(id);
|
||||
self.rooms.entry(name.clone()).or_default().insert(id);
|
||||
|
||||
self.send_message(&name, "Someone connected", id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user