Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

[RCD-28] cherry pick fix from release/1.3.1 #3711

Merged
merged 2 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/src/Pos/Network/Block/Retrieval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import Universum

import Control.Concurrent.STM (TVar, newTVar, putTMVar, swapTMVar,
swapTVar, tryReadTBQueue, tryReadTMVar, tryTakeTMVar)
import Control.Exception.Safe (handleAny)
import Control.Exception.Safe (IOException, handleAny)
import Control.Lens (to)
import Control.Monad.STM (retry)
import qualified Data.List.NonEmpty as NE
import Data.Time.Units (Second)
import Formatting (build, int, sformat, (%))
import Formatting (build, int, sformat, shown, (%))

import Pos.Chain.Block (Block, BlockHeader, HasHeaderHash (..),
HeaderHash)
HeaderHash, headerHashF)
import Pos.Chain.Genesis as Genesis (Config)
import Pos.Chain.Txp (TxpConfiguration)
import Pos.Core (difficultyL, isMoreDifficult)
Expand Down Expand Up @@ -155,10 +155,14 @@ retrievalWorker genesisConfig txpConfig diffusion = do
-- again.
handleRecoveryE nodeId rHeader e = do
-- REPORT:ERROR 'reportOrLogW' in block retrieval worker/recovery.
reportOrLogW (sformat
("handleRecoveryE: error handling nodeId="%build%", header="%build%": ")
nodeId (headerHash rHeader)) e
reportOrLogW (sformat errfmt nodeId (headerHash rHeader)) e
`catch` handleIOException
dropRecoveryHeaderAndRepeat genesisConfig diffusion nodeId
where
errfmt = "handleRecoveryE: error handling nodeId="%build%", header="%headerHashF%": "

handleIOException :: IOException -> m ()
handleIOException _ = logError $ sformat (errfmt%shown) nodeId (headerHash rHeader) e

-- Recovery handling. We assume that header in the recovery variable is
-- appropriate and just query headers/blocks.
Expand Down
4 changes: 1 addition & 3 deletions networking/src/Network/Broadcast/OutboundQueue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,9 +1036,7 @@ intDequeue outQ@OutQ{..} threadRegistry@TR{} sendMsg = do
logFailure outQ FailedSend (Some p, err)
intFailure outQ p sendStartTime err
Nothing ->
return ()

logDebugOQ outQ $ debugSent p
logDebugOQ outQ $ debugSent p

return (PacketDequeued theThread)
return ()
Expand Down