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
d25ee4ac
Commit
d25ee4ac
authored
3 years ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
manually connect new hosts added to the hostpool
parent
142724bf
No related branches found
No related tags found
3 merge requests
!231
Revert "Update store to print changes to the partners list"
,
!187
Xx 3829/triggers
,
!183
manually connect new hosts added to the hostpool
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
network/gateway/hostPool.go
+22
-18
22 additions, 18 deletions
network/gateway/hostPool.go
with
22 additions
and
18 deletions
network/gateway/hostPool.go
+
22
−
18
View file @
d25ee4ac
...
@@ -74,21 +74,23 @@ type HostPool struct {
...
@@ -74,21 +74,23 @@ type HostPool struct {
// PoolParams Allows configuration of HostPool parameters
// PoolParams Allows configuration of HostPool parameters
type
PoolParams
struct
{
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. Disabled if zero.
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
LazyConnection
bool
// Flag determining whether Host connections are initialized when added to HostPool
HostParams
connect
.
HostParams
// Parameters for the creation of new Host objects
}
}
// DefaultPoolParams Returns a default set of PoolParams
// DefaultPoolParams Returns a default set of PoolParams
func
DefaultPoolParams
()
PoolParams
{
func
DefaultPoolParams
()
PoolParams
{
p
:=
PoolParams
{
p
:=
PoolParams
{
MaxPoolSize
:
30
,
MaxPoolSize
:
30
,
ProxyAttempts
:
5
,
ProxyAttempts
:
5
,
PoolSize
:
0
,
PoolSize
:
0
,
MaxPings
:
0
,
MaxPings
:
0
,
HostParams
:
connect
.
GetDefaultHostParams
(),
LazyConnection
:
true
,
HostParams
:
connect
.
GetDefaultHostParams
(),
}
}
p
.
HostParams
.
MaxRetries
=
1
p
.
HostParams
.
MaxRetries
=
1
p
.
HostParams
.
MaxSendRetries
=
1
p
.
HostParams
.
MaxSendRetries
=
1
...
@@ -548,12 +550,14 @@ func (h *HostPool) replaceHostNoStore(newId *id.ID, oldPoolIndex uint32) error {
...
@@ -548,12 +550,14 @@ func (h *HostPool) replaceHostNoStore(newId *id.ID, oldPoolIndex uint32) error {
}
}
// Manually connect the new Host
// Manually connect the new Host
go
func
()
{
if
!
h
.
poolParams
.
LazyConnection
{
err
:=
newHost
.
Connect
()
go
func
()
{
if
err
!=
nil
{
err
:=
newHost
.
Connect
()
jww
.
WARN
.
Printf
(
"Unable to initialize Host connection: %+v"
,
err
)
if
err
!=
nil
{
}
jww
.
WARN
.
Printf
(
"Unable to initialize Host connection: %+v"
,
err
)
}()
}
}()
}
jww
.
DEBUG
.
Printf
(
"Replaced Host at %d [%s] with new Host %s"
,
oldPoolIndex
,
oldHostIDStr
,
jww
.
DEBUG
.
Printf
(
"Replaced Host at %d [%s] with new Host %s"
,
oldPoolIndex
,
oldHostIDStr
,
newId
.
String
())
newId
.
String
())
...
@@ -721,8 +725,8 @@ func readUint32(rng io.Reader) uint32 {
...
@@ -721,8 +725,8 @@ func readUint32(rng io.Reader) uint32 {
func
readRangeUint32
(
start
,
end
uint32
,
rng
io
.
Reader
)
uint32
{
func
readRangeUint32
(
start
,
end
uint32
,
rng
io
.
Reader
)
uint32
{
size
:=
end
-
start
size
:=
end
-
start
// note we could just do the part inside the () here, but then extra
// note we could just do the part inside the () here, but then extra
// can == size which means a little
bit of
range is waste
s
, either
// can == size which means a little range is waste
d
, either
// choice seems negligible so we went with the "more correct"
// choice seems negligible
,
so we went with the "more correct"
extra
:=
(
math
.
MaxUint32
%
size
+
1
)
%
size
extra
:=
(
math
.
MaxUint32
%
size
+
1
)
%
size
limit
:=
math
.
MaxUint32
-
extra
limit
:=
math
.
MaxUint32
-
extra
// Loop until we read something inside the limit
// Loop until we read something inside the limit
...
...
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