summaryrefslogtreecommitdiff
path: root/main/Test.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-07-28 19:16:18 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-07-29 09:33:16 +0200
commitd8160f03094e6d18509956efe9bb6aeda31d79c5 (patch)
treeef45877dcf6e64591ab08fec18356c1bc5738388 /main/Test.hs
parent8bcaaf5524504f01bd5643d74848cec625370aa9 (diff)
Return peer address in IO monad
Changelog: API: Replaced `Network.peerAddress` with `getPeerAddress` and added `getPeerAddresses`
Diffstat (limited to 'main/Test.hs')
-rw-r--r--main/Test.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/main/Test.hs b/main/Test.hs
index 093d3ac..1167bee 100644
--- a/main/Test.hs
+++ b/main/Test.hs
@@ -557,9 +557,12 @@ cmdStartServer = do
peer <- getNextPeerChange rsServer
let printPeer TestPeer {..} = do
- params <- peerIdentity tpPeer >>= return . \case
- PeerIdentityFull pid -> ("id":) $ map (maybe "<unnamed>" T.unpack . idName) (unfoldOwners pid)
- _ -> [ "addr", show (peerAddress tpPeer) ]
+ params <- peerIdentity tpPeer >>= \case
+ PeerIdentityFull pid -> do
+ return $ ("id":) $ map (maybe "<unnamed>" T.unpack . idName) (unfoldOwners pid)
+ _ -> do
+ paddr <- getPeerAddress tpPeer
+ return $ [ "addr", show paddr ]
outLine out $ unwords $ [ "peer", show tpIndex ] ++ params
update ( tpIndex, [] ) = do
@@ -611,9 +614,10 @@ cmdPeerList = do
forM_ peers $ \peer -> do
Just tp <- return $ find ((peer ==) . tpPeer) . snd $ tpeers
mbpid <- peerIdentity peer
+ paddr <- getPeerAddress peer
cmdOut $ unwords $ concat
[ [ "peer-list-item", show (tpIndex tp) ]
- , [ "addr", show (peerAddress peer) ]
+ , [ "addr", show paddr ]
, case mbpid of PeerIdentityFull pid -> ("id":) $ map (maybe "<unnamed>" T.unpack . idName) (unfoldOwners pid)
_ -> []
]