More reorg
This commit is contained in:
parent
cbec13eecc
commit
779e5964fa
2 changed files with 8 additions and 1 deletions
|
@ -29,7 +29,13 @@ fn chat_route(req: &HttpRequest<WsChatSessionState>) -> Result<HttpResponse, Err
|
||||||
WSSession {
|
WSSession {
|
||||||
id: 0,
|
id: 0,
|
||||||
hb: Instant::now(),
|
hb: Instant::now(),
|
||||||
ip: req.connection_info().remote().unwrap_or("127.0.0.1:12345").split(":").next().unwrap_or("127.0.0.1").to_string()
|
ip: req.connection_info()
|
||||||
|
.remote()
|
||||||
|
.unwrap_or("127.0.0.1:12345")
|
||||||
|
.split(":")
|
||||||
|
.next()
|
||||||
|
.unwrap_or("127.0.0.1")
|
||||||
|
.to_string()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1233,6 +1233,7 @@ impl Perform for GetPost {
|
||||||
sessions.remove(&addr);
|
sessions.remove(&addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the room doesn't exist yet
|
||||||
if chat.rooms.get_mut(&self.id).is_none() {
|
if chat.rooms.get_mut(&self.id).is_none() {
|
||||||
chat.rooms.insert(self.id, HashSet::new());
|
chat.rooms.insert(self.id, HashSet::new());
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue