gameServer/Utils.hs
changeset 15721 27eb5abd5058
parent 15469 88770c206c31
child 15900 fc3cb23fd26f
--- a/gameServer/Utils.hs	Tue Jul 07 00:17:05 2020 +0200
+++ b/gameServer/Utils.hs	Wed Jul 08 17:02:45 2020 +0300
@@ -41,11 +41,7 @@
 
 
 sockAddr2String :: SockAddr -> IO B.ByteString
-sockAddr2String (SockAddrInet _ hostAddr) = liftM B.pack $ inet_ntoa hostAddr
-sockAddr2String (SockAddrInet6 _ _ (a, b, c, d) _) =
-    return $ B.pack $ (foldr1 (.)
-        $ List.intersperse (':':)
-        $ concatMap (\n -> (\(a0, a1) -> [showHex a0, showHex a1]) $ divMod n 65536) [a, b, c, d]) []
+sockAddr2String = liftM (B.pack . fromJust . fst) . getNameInfo [] True False
 
 maybeRead :: Read a => String -> Maybe a
 maybeRead s = case reads s of