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