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
d4ddb5cf
Commit
d4ddb5cf
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add prose worthy comments explaining the bug fix
parent
1e39f030
No related branches found
No related tags found
2 merge requests
!510
Release
,
!398
Add debug log for file transfer not quitting
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fileTransfer/send.go
+19
-7
19 additions, 7 deletions
fileTransfer/send.go
with
19 additions
and
7 deletions
fileTransfer/send.go
+
19
−
7
View file @
d4ddb5cf
...
@@ -74,32 +74,44 @@ func (m *manager) sendingThread(stop *stoppable.Single) {
...
@@ -74,32 +74,44 @@ func (m *manager) sendingThread(stop *stoppable.Single) {
healthChanID
:=
m
.
cmix
.
AddHealthCallback
(
func
(
b
bool
)
{
healthChan
<-
b
})
healthChanID
:=
m
.
cmix
.
AddHealthCallback
(
func
(
b
bool
)
{
healthChan
<-
b
})
for
{
for
{
select
{
select
{
// A quit signal has been sent by the user. Typically, this is a result
// of a user-level shutdown of the client.
case
<-
stop
.
Quit
()
:
case
<-
stop
.
Quit
()
:
jww
.
DEBUG
.
Printf
(
"[FT] Stopping file part sending thread (%s): "
+
jww
.
DEBUG
.
Printf
(
"[FT] Stopping file part sending thread (%s): "
+
"stoppable triggered."
,
stop
.
Name
())
"stoppable triggered."
,
stop
.
Name
())
m
.
cmix
.
RemoveHealthCallback
(
healthChanID
)
m
.
cmix
.
RemoveHealthCallback
(
healthChanID
)
stop
.
ToStopped
()
stop
.
ToStopped
()
return
return
// If the network becomes unhealthy, we will cease sending files until
// it is resolved.
case
healthy
:=
<-
healthChan
:
case
healthy
:=
<-
healthChan
:
// There exists an edge case where an unhealthy signal is received
// due to a user-level shutdown, meaning the health tracker has
// ceased operation. If the health tracker is shutdown, a healthy
// signal will never be received, and this for loop will run
// infinitely. If we are caught in this loop, the stop's Quit()
// signal will never be received in case statement above, and this
// sender thread will run indefinitely. To avoid lingering threads
// in the case of a shutdown, we must actively listen for either the
// Quit() signal or a network health update here.
for
!
healthy
{
for
!
healthy
{
select
{
select
{
case
<-
stop
.
Quit
()
:
case
<-
stop
.
Quit
()
:
// It's possible during shutdown that the health tracker gets
// Listen for a quit signal if the network becomes unhealthy
// shutdown before the quit signal is received by the case
// before a user-level shutdown.
// statement listening for stop.Quit() above. As a result, we
// must listen for the quit signal here, to avoid waiting
// for a healthy signal that will never come.
jww
.
DEBUG
.
Printf
(
"[FT] Stopping file part sending "
+
jww
.
DEBUG
.
Printf
(
"[FT] Stopping file part sending "
+
"thread (%s): stoppable triggered."
,
stop
.
Name
())
"thread (%s): stoppable triggered."
,
stop
.
Name
())
m
.
cmix
.
RemoveHealthCallback
(
healthChanID
)
m
.
cmix
.
RemoveHealthCallback
(
healthChanID
)
stop
.
ToStopped
()
stop
.
ToStopped
()
return
return
// If a quit signal is not received, we must wait until the
// Wait for a healthy signal before continuing to send files.
// network is healthy before we can continue sending files.
case
healthy
=
<-
healthChan
:
case
healthy
=
<-
healthChan
:
}
}
}
}
// A file part has been sent through the queue and must be sent by
// this thread.
case
packet
:=
<-
m
.
sendQueue
:
case
packet
:=
<-
m
.
sendQueue
:
m
.
sendCmix
(
packet
)
m
.
sendCmix
(
packet
)
}
}
...
...
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