diff options
author | Dessalines <tyhou13@gmx.com> | 2019-05-04 08:53:29 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-05-04 08:53:29 -0700 |
commit | 779e5964fadc51fd59de1ca53d9a65e7c4f367ad (patch) | |
tree | 584ea57f0106b0260f29be89c5df2b466e1ef886 /server | |
parent | cbec13eeccd7fe1b18ca6f1f2c6c77c54c96a55f (diff) |
More reorg
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main.rs | 8 | ||||
-rw-r--r-- | server/src/websocket/server.rs | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index 3e51785b..add17cfd 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -29,7 +29,13 @@ fn chat_route(req: &HttpRequest<WsChatSessionState>) -> Result<HttpResponse, Err WSSession { id: 0, 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() }, ) } diff --git a/server/src/websocket/server.rs b/server/src/websocket/server.rs index a530b9a6..07378d37 100644 --- a/server/src/websocket/server.rs +++ b/server/src/websocket/server.rs @@ -1233,6 +1233,7 @@ impl Perform for GetPost { sessions.remove(&addr); } + // If the room doesn't exist yet if chat.rooms.get_mut(&self.id).is_none() { chat.rooms.insert(self.id, HashSet::new()); } |