forked from schmittlauch/Hash2Pub
add some debug output prints
This commit is contained in:
parent
2c827ea326
commit
4e359775ec
|
@ -213,6 +213,7 @@ handleIncomingRequest nsSTM sendQ msgSet sourceAddr = do
|
||||||
-- | execute a key ID lookup on local cache and respond with the result
|
-- | execute a key ID lookup on local cache and respond with the result
|
||||||
respondQueryID :: LocalNodeStateSTM -> Set.Set FediChordMessage -> IO (Map.Map Integer BS.ByteString)
|
respondQueryID :: LocalNodeStateSTM -> Set.Set FediChordMessage -> IO (Map.Map Integer BS.ByteString)
|
||||||
respondQueryID nsSTM msgSet = do
|
respondQueryID nsSTM msgSet = do
|
||||||
|
putStrLn "responding to a QueryID request"
|
||||||
-- this message cannot be split reasonably, so just
|
-- this message cannot be split reasonably, so just
|
||||||
-- consider the first payload
|
-- consider the first payload
|
||||||
let
|
let
|
||||||
|
@ -487,7 +488,10 @@ sendRequestTo :: Int -- ^ timeout in seconds
|
||||||
sendRequestTo timeoutMillis numAttempts msgIncomplete sock = do
|
sendRequestTo timeoutMillis numAttempts msgIncomplete sock = do
|
||||||
-- give the message a random request ID
|
-- give the message a random request ID
|
||||||
randomID <- randomRIO (0, 2^32-1)
|
randomID <- randomRIO (0, 2^32-1)
|
||||||
let requests = serialiseMessage sendMessageSize $ msgIncomplete randomID
|
let
|
||||||
|
msgComplete = msgIncomplete randomID
|
||||||
|
requests = serialiseMessage sendMessageSize msgComplete
|
||||||
|
putStrLn $ "sending request message " <> show msgComplete
|
||||||
-- create a queue for passing received response messages back, even after a timeout
|
-- create a queue for passing received response messages back, even after a timeout
|
||||||
responseQ <- newTBQueueIO $ 2*maximumParts -- keep room for duplicate packets
|
responseQ <- newTBQueueIO $ 2*maximumParts -- keep room for duplicate packets
|
||||||
-- start sendAndAck with timeout
|
-- start sendAndAck with timeout
|
||||||
|
|
|
@ -128,6 +128,7 @@ fediChordBootstrapJoin :: LocalNodeStateSTM -- ^ the local 'NodeSta
|
||||||
fediChordBootstrapJoin nsSTM (joinHost, joinPort) =
|
fediChordBootstrapJoin nsSTM (joinHost, joinPort) =
|
||||||
-- can be invoked multiple times with all known bootstrapping nodes until successfully joined
|
-- can be invoked multiple times with all known bootstrapping nodes until successfully joined
|
||||||
bracket (mkSendSocket joinHost joinPort) close (\sock -> do
|
bracket (mkSendSocket joinHost joinPort) close (\sock -> do
|
||||||
|
putStrLn "BootstrapJoin"
|
||||||
-- 1. get routed to placement of own ID until FOUND:
|
-- 1. get routed to placement of own ID until FOUND:
|
||||||
-- Initialise an empty cache only with the responses from a bootstrapping node
|
-- Initialise an empty cache only with the responses from a bootstrapping node
|
||||||
ns <- readTVarIO nsSTM
|
ns <- readTVarIO nsSTM
|
||||||
|
@ -145,6 +146,7 @@ fediChordBootstrapJoin nsSTM (joinHost, joinPort) =
|
||||||
Just (FORWARD resultset) -> foldr' (addCacheEntryPure now) cacheAcc resultset
|
Just (FORWARD resultset) -> foldr' (addCacheEntryPure now) cacheAcc resultset
|
||||||
)
|
)
|
||||||
initCache bootstrapResponse
|
initCache bootstrapResponse
|
||||||
|
putStrLn "initialised bootstrap cache"
|
||||||
fediChordJoin bootstrapCache nsSTM
|
fediChordJoin bootstrapCache nsSTM
|
||||||
)
|
)
|
||||||
`catch` (\e -> pure . Left $ "Error at bootstrap joining: " <> displayException (e :: IOException))
|
`catch` (\e -> pure . Left $ "Error at bootstrap joining: " <> displayException (e :: IOException))
|
||||||
|
|
Loading…
Reference in a new issue