add some debug output prints

This commit is contained in:
Trolli Schmittlauch 2020-06-08 20:31:22 +02:00
parent 2c827ea326
commit 4e359775ec
2 changed files with 7 additions and 1 deletions

View file

@ -213,6 +213,7 @@ handleIncomingRequest nsSTM sendQ msgSet sourceAddr = do
-- | 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 nsSTM msgSet = do
putStrLn "responding to a QueryID request"
-- this message cannot be split reasonably, so just
-- consider the first payload
let
@ -487,7 +488,10 @@ sendRequestTo :: Int -- ^ timeout in seconds
sendRequestTo timeoutMillis numAttempts msgIncomplete sock = do
-- give the message a random request ID
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
responseQ <- newTBQueueIO $ 2*maximumParts -- keep room for duplicate packets
-- start sendAndAck with timeout

View file

@ -128,6 +128,7 @@ fediChordBootstrapJoin :: LocalNodeStateSTM -- ^ the local 'NodeSta
fediChordBootstrapJoin nsSTM (joinHost, joinPort) =
-- can be invoked multiple times with all known bootstrapping nodes until successfully joined
bracket (mkSendSocket joinHost joinPort) close (\sock -> do
putStrLn "BootstrapJoin"
-- 1. get routed to placement of own ID until FOUND:
-- Initialise an empty cache only with the responses from a bootstrapping node
ns <- readTVarIO nsSTM
@ -145,6 +146,7 @@ fediChordBootstrapJoin nsSTM (joinHost, joinPort) =
Just (FORWARD resultset) -> foldr' (addCacheEntryPure now) cacheAcc resultset
)
initCache bootstrapResponse
putStrLn "initialised bootstrap cache"
fediChordJoin bootstrapCache nsSTM
)
`catch` (\e -> pure . Left $ "Error at bootstrap joining: " <> displayException (e :: IOException))