summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/Main.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/main/Main.hs b/main/Main.hs
index 94c0418..32c226f 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -540,8 +540,19 @@ cmdPeerAdd = void $ do
cmdPeerAddPublic :: Command
cmdPeerAddPublic = do
server <- asks ciServer
- addr:_ <- liftIO $ getAddrInfo (Just $ defaultHints { addrSocketType = Datagram }) (Just "discovery1.erebosprotocol.net") (Just (show discoveryPort))
- void $ liftIO $ serverPeer server (addrAddress addr)
+ liftIO $ mapM_ (serverPeer server . addrAddress) =<< gather 'a'
+ where
+ gather c
+ | c <= 'z' = do
+ let hints = Just $ defaultHints { addrSocketType = Datagram }
+ hostname = Just $ c : ".discovery.erebosprotocol.net"
+ service = Just $ show discoveryPort
+ handle (\(_ :: IOException) -> return []) (getAddrInfo hints hostname service) >>= \case
+ addr : _ -> (addr :) <$> gather (succ c)
+ [] -> return []
+
+ | otherwise = do
+ return []
cmdPeerDrop :: Command
cmdPeerDrop = do