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
7b3b9672
Commit
7b3b9672
authored
Apr 13, 2021
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added the transmit mux to stop disconnects while operations are
ongoing with the host
parent
eb3dca65
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
connect/host.go
+3
-2
3 additions, 2 deletions
connect/host.go
connect/transmit.go
+3
-0
3 additions, 0 deletions
connect/transmit.go
with
6 additions
and
2 deletions
connect/host.go
+
3
−
2
View file @
7b3b9672
...
...
@@ -82,6 +82,7 @@ type Host struct {
// Send lock
sendMux
sync
.
RWMutex
transmitMux
sync
.
RWMutex
coolOffBucket
*
rateLimiting
.
Bucket
inCoolOff
bool
...
...
@@ -221,8 +222,8 @@ func (h *Host) SetMetricsTesting(m *Metric, face interface{}) {
// Disconnect closes a the Host connection under the write lock
func
(
h
*
Host
)
Disconnect
()
{
h
.
send
Mux
.
Lock
()
defer
h
.
send
Mux
.
Unlock
()
h
.
transmit
Mux
.
Lock
()
defer
h
.
transmit
Mux
.
Unlock
()
h
.
disconnect
()
}
...
...
This diff is collapsed.
Click to expand it.
connect/transmit.go
+
3
−
0
View file @
7b3b9672
...
...
@@ -27,6 +27,9 @@ func (c *ProtoComms) transmit(host *Host, f func(conn *grpc.ClientConn) (interfa
return
nil
,
errors
.
New
(
"Host address is blank, host might be receive only."
)
}
host
.
transmitMux
.
RLock
()
defer
host
.
transmitMux
.
RUnlock
()
for
numRetries
:=
0
;
numRetries
<
MaxRetries
;
numRetries
++
{
err
=
nil
//reconnect if necessary
...
...
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