Skip to content
Snippets Groups Projects
Commit 59b6afd9 authored by Jono Wenger's avatar Jono Wenger
Browse files

Update debug messages

parent 199c7ba3
No related branches found
No related tags found
2 merge requests!117Release,!105XX-3617 / faster file transfer
......@@ -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++
......
......@@ -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
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment