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
7da62010
Commit
7da62010
authored
3 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added a hack to fix stop network follower crashes
parent
a63c881b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
interfaces/IsRunning.go
+8
-0
8 additions, 0 deletions
interfaces/IsRunning.go
network/follow.go
+14
-3
14 additions, 3 deletions
network/follow.go
network/manager.go
+1
-1
1 addition, 1 deletion
network/manager.go
stoppable/single.go
+1
-1
1 addition, 1 deletion
stoppable/single.go
with
24 additions
and
5 deletions
interfaces/IsRunning.go
0 → 100644
+
8
−
0
View file @
7da62010
package
interfaces
// this interface is used to allow the follower to to be stopped later if it
// fails
type
Running
interface
{
IsRunning
()
bool
}
This diff is collapsed.
Click to expand it.
network/follow.go
+
14
−
3
View file @
7da62010
...
...
@@ -46,7 +46,7 @@ type followNetworkComms interface {
// followNetwork polls the network to get updated on the state of nodes, the
// round status, and informs the client when messages can be retrieved.
func
(
m
*
manager
)
followNetwork
(
report
interfaces
.
ClientErrorReport
,
quitCh
<-
chan
struct
{})
{
func
(
m
*
manager
)
followNetwork
(
report
interfaces
.
ClientErrorReport
,
quitCh
<-
chan
struct
{}
,
isRunning
interfaces
.
Running
)
{
ticker
:=
time
.
NewTicker
(
m
.
param
.
TrackNetworkPeriod
)
TrackTicker
:=
time
.
NewTicker
(
debugTrackPeriod
)
rng
:=
m
.
Rng
.
GetStream
()
...
...
@@ -58,17 +58,23 @@ func (m *manager) followNetwork(report interfaces.ClientErrorReport, quitCh <-ch
rng
.
Close
()
done
=
true
case
<-
ticker
.
C
:
m
.
follow
(
report
,
rng
,
m
.
Comms
)
m
.
follow
(
report
,
rng
,
m
.
Comms
,
isRunning
)
case
<-
TrackTicker
.
C
:
numPolls
:=
atomic
.
SwapUint64
(
m
.
tracker
,
0
)
jww
.
INFO
.
Printf
(
"Polled the network %d times in the "
+
"last %s"
,
numPolls
,
debugTrackPeriod
)
}
if
!
isRunning
.
IsRunning
(){
jww
.
ERROR
.
Printf
(
"Killing network follower "
+
"due to failed exit"
)
return
}
}
}
// executes each iteration of the follower
func
(
m
*
manager
)
follow
(
report
interfaces
.
ClientErrorReport
,
rng
csprng
.
Source
,
comms
followNetworkComms
)
{
func
(
m
*
manager
)
follow
(
report
interfaces
.
ClientErrorReport
,
rng
csprng
.
Source
,
comms
followNetworkComms
,
isRunning
interfaces
.
Running
)
{
//get the identity we will poll for
identity
,
err
:=
m
.
Session
.
Reception
()
.
GetIdentity
(
rng
)
...
...
@@ -100,6 +106,11 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
identity
.
EndRequest
,
identity
.
EndRequest
.
Sub
(
identity
.
StartRequest
),
host
.
GetId
())
return
comms
.
SendPoll
(
host
,
&
pollReq
)
})
if
!
isRunning
.
IsRunning
(){
jww
.
ERROR
.
Printf
(
"Killing network follower "
+
"due to failed exit"
)
return
}
if
err
!=
nil
{
if
report
!=
nil
{
report
(
...
...
This diff is collapsed.
Click to expand it.
network/manager.go
+
1
−
1
View file @
7da62010
...
...
@@ -130,7 +130,7 @@ func (m *manager) Follow(report interfaces.ClientErrorReport) (stoppable.Stoppab
// Start the Network Tracker
trackNetworkStopper
:=
stoppable
.
NewSingle
(
"TrackNetwork"
)
go
m
.
followNetwork
(
report
,
trackNetworkStopper
.
Quit
())
go
m
.
followNetwork
(
report
,
trackNetworkStopper
.
Quit
()
,
trackNetworkStopper
)
multi
.
Add
(
trackNetworkStopper
)
// Message reception
...
...
This diff is collapsed.
Click to expand it.
stoppable/single.go
+
1
−
1
View file @
7da62010
...
...
@@ -52,7 +52,6 @@ func (s *Single) Name() string {
func
(
s
*
Single
)
Close
(
timeout
time
.
Duration
)
error
{
var
err
error
s
.
once
.
Do
(
func
()
{
atomic
.
StoreUint32
(
&
s
.
running
,
0
)
timer
:=
time
.
NewTimer
(
timeout
)
select
{
case
<-
timer
.
C
:
...
...
@@ -61,6 +60,7 @@ func (s *Single) Close(timeout time.Duration) error {
err
=
errors
.
Errorf
(
"%s failed to close"
,
s
.
name
)
case
s
.
quit
<-
struct
{}{}
:
}
atomic
.
StoreUint32
(
&
s
.
running
,
0
)
})
return
err
}
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