mirror of https://github.com/voidlizard/hbs2
maybe fix TCP busyloop
This commit is contained in:
parent
9a0ab0e024
commit
6df825226d
|
@ -39,6 +39,7 @@ import Network.Socket hiding (listen,connect)
|
||||||
import System.Random hiding (next)
|
import System.Random hiding (next)
|
||||||
import Control.Monad.Trans.Cont
|
import Control.Monad.Trans.Cont
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
import Control.Concurrent.STM qualified as STM
|
||||||
|
|
||||||
import UnliftIO (MonadUnliftIO(..))
|
import UnliftIO (MonadUnliftIO(..))
|
||||||
import UnliftIO.Async
|
import UnliftIO.Async
|
||||||
|
@ -391,16 +392,14 @@ runMessagingTCP env@MessagingTCP{..} = liftIO do
|
||||||
-- client sockets
|
-- client sockets
|
||||||
|
|
||||||
-- смотрим к кому надо
|
-- смотрим к кому надо
|
||||||
who <- atomically $ readTQueue _tcpConnDemand
|
who <- atomically do
|
||||||
whoAddr <- toPeerAddr who
|
who <- readTQueue _tcpConnDemand
|
||||||
|
already <- readTVar _tcpPeerConn <&> HM.member who
|
||||||
|
if not already then pure who else STM.retry
|
||||||
|
|
||||||
debug $ "DEMAND:" <+> pretty who
|
debug $ "DEMAND:" <+> pretty who
|
||||||
|
|
||||||
already <- atomically $ readTVar _tcpPeerConn <&> HM.member who
|
whoAddr <- toPeerAddr who
|
||||||
|
|
||||||
when already do
|
|
||||||
debug "SHIT? BUSYLOOP?"
|
|
||||||
mzero
|
|
||||||
|
|
||||||
liftIO $ newClientThread env $ do
|
liftIO $ newClientThread env $ do
|
||||||
let (L4Address _ (IPAddrPort (ip,port))) = whoAddr
|
let (L4Address _ (IPAddrPort (ip,port))) = whoAddr
|
||||||
|
|
Loading…
Reference in New Issue