Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
e7ae218b
Commit
e7ae218b
authored
Jul 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/zodb/zeo: Shutdown zlink on first error
The same behaviour as ZEO/py does.
parent
b82154d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+13
-8
No files found.
go/zodb/storage/zeo/zrpc.go
View file @
e7ae218b
...
...
@@ -68,7 +68,7 @@ type zLink struct {
serveWg
sync
.
WaitGroup
// for serveRecv
down1
sync
.
Once
err
Close
error
// error got from .link.Close()
err
Down
error
// error with which the link was shut down
ver
string
// protocol verision in use (without "Z" or "M" prefix)
}
...
...
@@ -82,11 +82,17 @@ func (zl *zLink) start() {
var
errLinkClosed
=
errors
.
New
(
"zlink is closed"
)
// shutdown shuts zlink down and sets
error (XXX) which
// shutdown shuts zlink down and sets
reason of why the link was shut down.
func
(
zl
*
zLink
)
shutdown
(
err
error
)
{
zl
.
down1
.
Do
(
func
()
{
// XXX what with err?
zl
.
errClose
=
zl
.
link
.
Close
()
err2
:=
zl
.
link
.
Close
()
if
err
==
nil
{
err
=
err2
}
if
err
!=
nil
{
log
.
Printf
(
"%s: %s"
,
zl
.
link
.
RemoteAddr
(),
err
)
}
zl
.
errDown
=
err
// notify call waiters
zl
.
callMu
.
Lock
()
...
...
@@ -103,7 +109,7 @@ func (zl *zLink) shutdown(err error) {
func
(
zl
*
zLink
)
Close
()
error
{
zl
.
shutdown
(
nil
)
zl
.
serveWg
.
Wait
()
// wait in case shutdown was called from serveRecv
return
zl
.
err
Close
return
zl
.
err
Down
}
...
...
@@ -121,10 +127,9 @@ func (zl *zLink) serveRecv() {
err
=
zl
.
serveRecv1
(
pkb
)
pkb
.
Free
()
// XXX ratelimit / only incstat?
if
err
!=
nil
{
log
.
Printf
(
"%s: rx: %s"
,
zl
.
link
.
RemoteAddr
(),
err
)
zl
.
shutdown
(
err
)
return
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment