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
64ef9564
Commit
64ef9564
authored
3 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
fix pipeline
parent
2aa7fdd9
No related branches found
No related tags found
2 merge requests
!53
Release
,
!33
Hotfix/ping
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
network/gateway/hostPool.go
+16
-5
16 additions, 5 deletions
network/gateway/hostPool.go
network/gateway/hostpool_test.go
+1
-1
1 addition, 1 deletion
network/gateway/hostpool_test.go
network/manager.go
+2
-0
2 additions, 0 deletions
network/manager.go
with
19 additions
and
6 deletions
network/gateway/hostPool.go
+
16
−
5
View file @
64ef9564
...
@@ -77,7 +77,7 @@ type PoolParams struct {
...
@@ -77,7 +77,7 @@ type PoolParams struct {
MaxPoolSize
uint32
// Maximum number of Hosts in the HostPool
MaxPoolSize
uint32
// Maximum number of Hosts in the HostPool
PoolSize
uint32
// Allows override of HostPool size. Set to zero for dynamic size calculation
PoolSize
uint32
// Allows override of HostPool size. Set to zero for dynamic size calculation
ProxyAttempts
uint32
// How many proxies will be used in event of send failure
ProxyAttempts
uint32
// How many proxies will be used in event of send failure
MaxPings
uint32
// How many gateways to concurrently test when initializing HostPool
MaxPings
uint32
// How many gateways to concurrently test when initializing HostPool
. Disabled if zero.
HostParams
connect
.
HostParams
// Parameters for the creation of new Host objects
HostParams
connect
.
HostParams
// Parameters for the creation of new Host objects
}
}
...
@@ -87,7 +87,7 @@ func DefaultPoolParams() PoolParams {
...
@@ -87,7 +87,7 @@ func DefaultPoolParams() PoolParams {
MaxPoolSize
:
30
,
MaxPoolSize
:
30
,
ProxyAttempts
:
5
,
ProxyAttempts
:
5
,
PoolSize
:
0
,
PoolSize
:
0
,
MaxPings
:
5
0
,
MaxPings
:
0
,
HostParams
:
connect
.
GetDefaultHostParams
(),
HostParams
:
connect
.
GetDefaultHostParams
(),
}
}
p
.
HostParams
.
MaxRetries
=
1
p
.
HostParams
.
MaxRetries
=
1
...
@@ -157,10 +157,21 @@ func newHostPool(poolParams PoolParams, rng *fastRNG.StreamGenerator,
...
@@ -157,10 +157,21 @@ func newHostPool(poolParams PoolParams, rng *fastRNG.StreamGenerator,
}
}
// Build the initial HostPool and return
// Build the initial HostPool and return
if
result
.
poolParams
.
MaxPings
>
0
{
// If pinging enabled, select random performant Hosts
err
=
result
.
initialize
(
uint32
(
numHostsAdded
))
err
=
result
.
initialize
(
uint32
(
numHostsAdded
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
else
{
// Else, select random Hosts
for
i
:=
numHostsAdded
;
i
<
len
(
result
.
hostList
);
i
++
{
err
:=
result
.
replaceHost
(
result
.
selectGateway
(),
uint32
(
i
))
if
err
!=
nil
{
return
nil
,
err
}
}
}
jww
.
INFO
.
Printf
(
"Initialized HostPool with size: %d/%d"
,
poolParams
.
PoolSize
,
len
(
netDef
.
Gateways
))
jww
.
INFO
.
Printf
(
"Initialized HostPool with size: %d/%d"
,
poolParams
.
PoolSize
,
len
(
netDef
.
Gateways
))
return
result
,
nil
return
result
,
nil
...
...
This diff is collapsed.
Click to expand it.
network/gateway/hostpool_test.go
+
1
−
1
View file @
64ef9564
...
@@ -371,7 +371,7 @@ func TestHostPool_ForceReplace(t *testing.T) {
...
@@ -371,7 +371,7 @@ func TestHostPool_ForceReplace(t *testing.T) {
oldHost
:=
testPool
.
hostList
[
oldGatewayIndex
]
oldHost
:=
testPool
.
hostList
[
oldGatewayIndex
]
// Force replace the gateway at a given index
// Force replace the gateway at a given index
err
=
testPool
.
forceReplace
(
uint32
(
oldGatewayIndex
))
err
=
testPool
.
replaceHost
(
testPool
.
selectGateway
(),
uint32
(
oldGatewayIndex
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Failed to force replace: %v"
,
err
)
t
.
Errorf
(
"Failed to force replace: %v"
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
network/manager.go
+
2
−
0
View file @
64ef9564
...
@@ -114,6 +114,8 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
...
@@ -114,6 +114,8 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
poolParams
:=
gateway
.
DefaultPoolParams
()
poolParams
:=
gateway
.
DefaultPoolParams
()
// Client will not send KeepAlive packets
// Client will not send KeepAlive packets
poolParams
.
HostParams
.
KaClientOpts
.
Time
=
time
.
Duration
(
math
.
MaxInt64
)
poolParams
.
HostParams
.
KaClientOpts
.
Time
=
time
.
Duration
(
math
.
MaxInt64
)
// Enable optimized HostPool initialization
poolParams
.
MaxPings
=
50
m
.
sender
,
err
=
gateway
.
NewSender
(
poolParams
,
rng
,
m
.
sender
,
err
=
gateway
.
NewSender
(
poolParams
,
rng
,
ndf
,
comms
,
session
,
m
.
NodeRegistration
)
ndf
,
comms
,
session
,
m
.
NodeRegistration
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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