hunting busyloops

This commit is contained in:
voidlizard 2025-03-08 13:56:53 +03:00
parent 1c4b9e7971
commit 541ecccd0b
2 changed files with 4 additions and 5 deletions

View File

@ -211,7 +211,7 @@ cleanupByPassMessaging bus pips = do
writeTVar (heySentNum bus) mempty writeTVar (heySentNum bus) mempty
writeTVar (noncesByPeer bus) livePeers writeTVar (noncesByPeer bus) livePeers
writeTVar (flowKeys bus) liveFlows writeTVar (flowKeys bus) liveFlows
modifyTVar (banned bus) (HM.filter (now>)) modifyTVar (banned bus) (HM.filter (>now))
byPassDef :: ByPassOpts e byPassDef :: ByPassOpts e
@ -296,7 +296,7 @@ instance (ForByPass e, Messaging w e ByteString)
when (heys > 10) do when (heys > 10) do
nowTs <- getTimeCoarse nowTs <- getTimeCoarse
let till = toTimeSpec (TimeoutTS nowTs) + toTimeSpec (TimeoutSec 600) let till = toTimeSpec (TimeoutTS nowTs) + toTimeSpec (TimeoutSec 1800)
atomically $ modifyTVar banned (HM.insert whom till) atomically $ modifyTVar banned (HM.insert whom till)
exit () exit ()
@ -369,7 +369,7 @@ instance (ForByPass e, Messaging w e ByteString)
debug $ "GOT HEY MESSAGE" <+> parens (pretty code) <+> pretty heyNonceA debug $ "GOT HEY MESSAGE" <+> parens (pretty code) <+> pretty heyNonceA
when (heyNonceA == nonceA) do when (heyNonceA == nonceA) do
let till = toTimeSpec (TimeoutTS nowTs) + toTimeSpec (TimeoutSec 600) let till = toTimeSpec (TimeoutTS nowTs) + toTimeSpec (TimeoutSec 3600)
atomically $ modifyTVar banned (HM.insert orig till) atomically $ modifyTVar banned (HM.insert orig till)
warn $ "ByPass: loop detected" warn $ "ByPass: loop detected"

View File

@ -56,7 +56,6 @@ byPassWorker bp@ByPass{..} = do
forever do forever do
pips <- lift getKnownPeers pips <- lift getKnownPeers
cleanupByPassMessaging bp pips cleanupByPassMessaging bp pips
pause @'Seconds 600 pause @'Seconds 120