Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
59b6afd9
Commit
59b6afd9
authored
3 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Update debug messages
parent
199c7ba3
No related branches found
No related tags found
2 merge requests
!117
Release
,
!105
XX-3617 / faster file transfer
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fileTransfer/oldTransferRecovery.go
+11
-10
11 additions, 10 deletions
fileTransfer/oldTransferRecovery.go
fileTransfer/receive.go
+4
-4
4 additions, 4 deletions
fileTransfer/receive.go
fileTransfer/receiveNew.go
+7
-6
7 additions, 6 deletions
fileTransfer/receiveNew.go
with
22 additions
and
20 deletions
fileTransfer/oldTransferRecovery.go
+
11
−
10
View file @
59b6afd9
...
...
@@ -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
++
...
...
This diff is collapsed.
Click to expand it.
fileTransfer/receive.go
+
4
−
4
View file @
59b6afd9
...
...
@@ -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
.
Print
f
(
"[FT] %+v"
,
err
)
}
else
{
jww
.
WARN
.
Print
(
err
)
jww
.
WARN
.
Print
(
"[FT] %+v"
,
err
)
}
continue
}
...
...
This diff is collapsed.
Click to expand it.
fileTransfer/receiveNew.go
+
7
−
6
View file @
59b6afd9
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment