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
0275ae84
Commit
0275ae84
authored
4 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added a lock to startnetworlfollower and stopnetworkfollwer so only one can run at a time
parent
498f079b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!23
Release
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/client.go
+9
-0
9 additions, 0 deletions
api/client.go
network/gateway/hostPool.go
+1
-1
1 addition, 1 deletion
network/gateway/hostPool.go
with
10 additions
and
1 deletion
api/client.go
+
9
−
0
View file @
0275ae84
...
@@ -30,6 +30,7 @@ import (
...
@@ -30,6 +30,7 @@ import (
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/ndf"
"gitlab.com/xx_network/primitives/ndf"
"sync"
"time"
"time"
)
)
...
@@ -65,6 +66,10 @@ type Client struct {
...
@@ -65,6 +66,10 @@ type Client struct {
services
*
serviceProcessiesList
services
*
serviceProcessiesList
clientErrorChannel
chan
interfaces
.
ClientError
clientErrorChannel
chan
interfaces
.
ClientError
//lock to ensure only once instance of stop/start network follower is
//going at a time
followerLock
sync
.
Mutex
}
}
// NewClient creates client storage, generates keys, connects, and registers
// NewClient creates client storage, generates keys, connects, and registers
...
@@ -381,6 +386,8 @@ func (c *Client) initPermissioning(def *ndf.NetworkDefinition) error {
...
@@ -381,6 +386,8 @@ func (c *Client) initPermissioning(def *ndf.NetworkDefinition) error {
// - Auth Callback (/auth/callback.go)
// - Auth Callback (/auth/callback.go)
// Handles both auth confirm and requests
// Handles both auth confirm and requests
func
(
c
*
Client
)
StartNetworkFollower
(
timeout
time
.
Duration
)
(
<-
chan
interfaces
.
ClientError
,
error
)
{
func
(
c
*
Client
)
StartNetworkFollower
(
timeout
time
.
Duration
)
(
<-
chan
interfaces
.
ClientError
,
error
)
{
c
.
followerLock
.
Lock
()
defer
c
.
followerLock
.
Unlock
()
u
:=
c
.
GetUser
()
u
:=
c
.
GetUser
()
jww
.
INFO
.
Printf
(
"StartNetworkFollower()
\n\t
TransmisstionID: %s "
+
jww
.
INFO
.
Printf
(
"StartNetworkFollower()
\n\t
TransmisstionID: %s "
+
"
\n\t
ReceptionID: %s"
,
u
.
TransmissionID
,
u
.
ReceptionID
)
"
\n\t
ReceptionID: %s"
,
u
.
TransmissionID
,
u
.
ReceptionID
)
...
@@ -441,6 +448,8 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces.
...
@@ -441,6 +448,8 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces.
// if the network follower is running and this fails, the client object will
// if the network follower is running and this fails, the client object will
// most likely be in an unrecoverable state and need to be trashed.
// most likely be in an unrecoverable state and need to be trashed.
func
(
c
*
Client
)
StopNetworkFollower
()
error
{
func
(
c
*
Client
)
StopNetworkFollower
()
error
{
c
.
followerLock
.
Lock
()
defer
c
.
followerLock
.
Unlock
()
err
:=
c
.
status
.
toStopping
()
err
:=
c
.
status
.
toStopping
()
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"Failed to Stop the Network Follower"
)
return
errors
.
WithMessage
(
err
,
"Failed to Stop the Network Follower"
)
...
...
This diff is collapsed.
Click to expand it.
network/gateway/hostPool.go
+
1
−
1
View file @
0275ae84
...
@@ -81,7 +81,7 @@ func DefaultPoolParams() PoolParams {
...
@@ -81,7 +81,7 @@ func DefaultPoolParams() PoolParams {
p
.
HostParams
.
EnableCoolOff
=
true
p
.
HostParams
.
EnableCoolOff
=
true
p
.
HostParams
.
NumSendsBeforeCoolOff
=
1
p
.
HostParams
.
NumSendsBeforeCoolOff
=
1
p
.
HostParams
.
CoolOffTimeout
=
5
*
time
.
Minute
p
.
HostParams
.
CoolOffTimeout
=
5
*
time
.
Minute
p
.
HostParams
.
SendTimeout
=
35
00
*
time
.
Millisecond
p
.
HostParams
.
SendTimeout
=
20
00
*
time
.
Millisecond
return
p
return
p
}
}
...
...
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