gameServer/Utils.hs
branch1.0.0
changeset 15861 9d4ba1912e71
parent 15445 88770c206c31
child 15878 fc3cb23fd26f
--- a/gameServer/Utils.hs	Mon Sep 12 10:44:55 2022 -0400
+++ b/gameServer/Utils.hs	Mon Sep 12 12:50:37 2022 -0400
@@ -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