diff --git a/fileTransfer/oldTransferRecovery.go b/fileTransfer/oldTransferRecovery.go index b6d3c6beb2dd8fdea40353621eae4c1946d835b4..a2d493168238111039539c3fafecb19a61cfb30b 100644 --- a/fileTransfer/oldTransferRecovery.go +++ b/fileTransfer/oldTransferRecovery.go @@ -16,8 +16,8 @@ import ( // Error messages. const ( - oldTransfersRoundResultsErr = "failed to recover round information for " + - "%d rounds for old file transfers after %d attempts" + oldTransfersRoundResultsErr = "[FT] failed to recover round information " + + "for %d rounds for old file transfers after %d attempts" ) // roundResultsMaxAttempts is the maximum number of attempts to get round @@ -30,8 +30,8 @@ func (m Manager) oldTransferRecovery(healthyChan chan bool, chanID uint64) { // Exit if old transfers have already been recovered if m.oldTransfersRecovered { - jww.DEBUG.Printf("Old file transfer recovery thread not starting: " + - "none to recover (app was not closed)") + jww.DEBUG.Printf("[FT] Old file transfer recovery thread not " + + "starting: none to recover (app was not closed)") return } @@ -44,7 +44,7 @@ func (m Manager) oldTransferRecovery(healthyChan chan bool, chanID uint64) { } if err != nil { - jww.ERROR.Printf("Failed to get sent rounds: %+v", err) + jww.ERROR.Printf("[FT] Failed to get sent rounds: %+v", err) m.net.GetHealthTracker().RemoveChannel(chanID) return } @@ -71,7 +71,7 @@ func (m Manager) updateSentRounds(healthyChan chan bool, // Tracks the number of attempts to get round results var getRoundResultsAttempts int - jww.DEBUG.Print("Starting old file transfer recovery thread.") + jww.DEBUG.Print("[FT] Starting old file transfer recovery thread.") // Wait for network to be healthy to attempt to get round states for getRoundResultsAttempts < roundResultsMaxAttempts { @@ -79,13 +79,13 @@ func (m Manager) updateSentRounds(healthyChan chan bool, case healthy := <-healthyChan: // If the network is unhealthy, wait until it becomes healthy if !healthy { - jww.DEBUG.Print("Suspending old file transfer recovery " + + jww.DEBUG.Print("[FT] Suspending old file transfer recovery " + "thread: network is unhealthy.") } for !healthy { healthy = <-healthyChan } - jww.DEBUG.Print("Old file transfer recovery thread: " + + jww.DEBUG.Print("[FT] Old file transfer recovery thread: " + "network is healthy.") // Register callback to get Round results and retry on error @@ -93,12 +93,13 @@ func (m Manager) updateSentRounds(healthyChan chan bool, err := m.getRoundResults(roundList, roundResultsTimeout, m.makeRoundEventCallback(sentRounds)) if err != nil { - jww.WARN.Printf("Failed to get round results for old "+ + jww.WARN.Printf("[FT] Failed to get round results for old "+ "transfers for rounds %d (attempt %d/%d): %+v", getRoundResultsAttempts, roundResultsMaxAttempts, roundList, err) } else { - jww.INFO.Printf("Successfully recovered old file transfers.") + jww.INFO.Printf( + "[FT] Successfully recovered old file transfers.") return nil } getRoundResultsAttempts++ diff --git a/fileTransfer/receive.go b/fileTransfer/receive.go index f1b2257dc43d384332f3d970caa4fda0b118d317..82781a1e865d8337f5d74b745db29c04d4085e21 100644 --- a/fileTransfer/receive.go +++ b/fileTransfer/receive.go @@ -25,12 +25,12 @@ const ( // receive runs a loop that receives file message parts and stores them in their // appropriate transfer. func (m *Manager) receive(rawMsgs chan message.Receive, stop *stoppable.Single) { - jww.DEBUG.Print("Starting file part reception thread.") + jww.DEBUG.Print("[FT] Starting file part reception thread.") for { select { case <-stop.Quit(): - jww.DEBUG.Print("Stopping file part reception thread: stoppable " + + jww.DEBUG.Print("[FT] Stopping file part reception thread: stoppable " + "triggered.") stop.ToStopped() return @@ -41,9 +41,9 @@ func (m *Manager) receive(rawMsgs chan message.Receive, stop *stoppable.Single) // which means this message is not of the correct type and will // be ignored if strings.Contains(err.Error(), "fingerprint") { - jww.INFO.Print(err) + jww.INFO.Printf("[FT] %+v", err) } else { - jww.WARN.Print(err) + jww.WARN.Print("[FT] %+v", err) } continue } diff --git a/fileTransfer/receiveNew.go b/fileTransfer/receiveNew.go index 2fa736cbbd2f7bd287095d4a8bfcd168f5d30707..45528f9ba270a94fa71ea1652ae1eb8c304375e9 100644 --- a/fileTransfer/receiveNew.go +++ b/fileTransfer/receiveNew.go @@ -27,26 +27,27 @@ const ( // messages. func (m *Manager) receiveNewFileTransfer(rawMsgs chan message.Receive, stop *stoppable.Single) { - jww.DEBUG.Print("Starting new file transfer message reception thread.") + jww.DEBUG.Print("[FT] Starting new file transfer message reception thread.") for { select { case <-stop.Quit(): - jww.DEBUG.Print("Stopping new file transfer message reception " + - "thread: stoppable triggered") + jww.DEBUG.Print("[FT] Stopping new file transfer message " + + "reception thread: stoppable triggered") stop.ToStopped() return case receivedMsg := <-rawMsgs: - jww.DEBUG.Print("New file transfer message thread received message.") + jww.DEBUG.Print( + "[FT] New file transfer message thread received message.") tid, fileName, fileType, sender, size, preview, err := m.readNewFileTransferMessage(receivedMsg) if err != nil { if err.Error() == receiveMessageTypeErr { - jww.INFO.Printf("Failed to read message as new file "+ + jww.INFO.Printf("[FT] Failed to read message as new file "+ "transfer message: %+v", err) } else { - jww.WARN.Printf("Failed to read message as new file "+ + jww.WARN.Printf("[FT] Failed to read message as new file "+ "transfer message: %+v", err) } continue