]> Untitled Git - lemmy.git/commitdiff
Fixing ip
authorDessalines <tyhou13@gmx.com>
Wed, 1 May 2019 23:00:26 +0000 (16:00 -0700)
committerDessalines <tyhou13@gmx.com>
Wed, 1 May 2019 23:00:26 +0000 (16:00 -0700)
server/src/bin/main.rs

index 701a4e36ea37dc73fb75aa03fd10fba5daf1d459..c2fde341d5490053348c6478f2f7136b3c1b2e81 100644 (file)
@@ -30,7 +30,7 @@ fn chat_route(req: &HttpRequest<WsChatSessionState>) -> Result<HttpResponse, Err
     WSSession {
       id: 0,
       hb: Instant::now(),
-      ip: req.connection_info().host().to_string(),
+      ip: req.connection_info().remote().unwrap_or("127.0.0.1:12345").split(":").next().unwrap_or("127.0.0.1").to_string()
     },
     )
 }