fixed? tcp pex

This commit is contained in:
Dmitry Zuikov 2023-10-20 19:45:40 +03:00
parent 351ac97d44
commit 4d756d6eaf
1 changed files with 7 additions and 8 deletions

View File

@ -709,14 +709,13 @@ runPeer opts = U.handle (\e -> myException e
rcw <- async $ liftIO $ runRefChanRelyWorker rce refChanAdapter
let pexFilt pips = do
tcpex <- listTCPPexCandidates @e brains <&> HashSet.fromList
fset <- forM pips $ \p -> do
toPeerAddr p >>= \case
(L4Address UDP _) -> pure $ Just p
pa@(L4Address TCP _) | HashSet.member pa tcpex -> pure $ Just p
_ -> pure Nothing
pure (catMaybes fset)
tcpex <- listTCPPexCandidates @e brains -- <&> HashSet.fromList
pips2 <- filter onlyUDP <$> mapM toPeerAddr pips
pure (L.nub (pips2 <> tcpex))
where
onlyUDP = \case
(L4Address UDP _) -> True
_ -> False
let onNoBlock (p, h) = do
already <- liftIO $ Cache.lookup nbcache (p,h) <&> isJust