Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
comms
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xx network
comms
Commits
2eb78ca8
Commit
2eb78ca8
authored
May 28, 2021
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added an option to set the window size
parent
175f698a
No related branches found
No related tags found
1 merge request
!11
Release
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
connect/host.go
+26
-3
26 additions, 3 deletions
connect/host.go
with
26 additions
and
3 deletions
connect/host.go
+
26
−
3
View file @
2eb78ca8
...
...
@@ -92,11 +92,17 @@ type Host struct {
// Stored default values (should be non-mutated)
params
HostParams
// the amount of data, when streaming, that a sender can send before receiving an ACK
// keep at zero to use the default GRPC algorithm to determine
windowSize
*
int32
}
// Creates a new Host object
func
NewHost
(
id
*
id
.
ID
,
address
string
,
cert
[]
byte
,
params
HostParams
)
(
host
*
Host
,
err
error
)
{
windowSize
:=
int32
(
0
)
// Initialize the Host object
host
=
&
Host
{
id
:
id
,
...
...
@@ -105,6 +111,7 @@ func NewHost(id *id.ID, address string, cert []byte, params HostParams) (host *H
receptionToken
:
token
.
NewLive
(),
metrics
:
newMetric
(),
params
:
params
,
windowSize
:
&
windowSize
,
}
if
params
.
EnableCoolOff
{
...
...
@@ -154,6 +161,12 @@ func (h *Host) IsDynamicHost() bool {
return
h
.
dynamicHost
}
// the amount of data, when streaming, that a sender can send before receiving an ACK
// keep at zero to use the default GRPC algorithm to determine
func
(
h
*
Host
)
SetWindowSize
(
size
int32
)
{
atomic
.
StoreInt32
(
h
.
windowSize
,
size
)
}
// Simple getter for the public key
func
(
h
*
Host
)
GetPubKey
()
*
rsa
.
PublicKey
{
return
h
.
rsaPublicKey
...
...
@@ -378,11 +391,21 @@ func (h *Host) connectHelper() (err error) {
}
ctx
,
cancel
:=
newContext
(
time
.
Duration
(
backoffTime
)
*
time
.
Millisecond
)
dialOpts
:=
[]
grpc
.
DialOption
{
grpc
.
WithBlock
(),
grpc
.
WithKeepaliveParams
(
KaClientOpts
),
securityDial
,
}
windowSize
:=
atomic
.
LoadInt32
(
h
.
windowSize
)
if
windowSize
!=
0
{
dialOpts
=
append
(
dialOpts
,
grpc
.
WithInitialWindowSize
(
windowSize
))
}
// Create the connection
h
.
connection
,
err
=
grpc
.
DialContext
(
ctx
,
h
.
GetAddress
(),
securityDial
,
grpc
.
WithBlock
(),
grpc
.
WithKeepaliveParams
(
KaClientOpts
))
dialOpts
...
)
if
err
!=
nil
{
jww
.
DEBUG
.
Printf
(
"Attempt number %+v to connect to %s failed
\n
"
,
numRetries
,
h
.
GetAddress
())
...
...
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