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
60033406
Commit
60033406
authored
Jul 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9373180a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+6
-6
No files found.
go/zodb/storage/zeo/zrpc.go
View file @
60033406
...
@@ -60,12 +60,13 @@ type zLink struct {
...
@@ -60,12 +60,13 @@ type zLink struct {
callTab
map
[
int64
]
chan
msg
// msgid -> rxc for that call; nil when closed
callTab
map
[
int64
]
chan
msg
// msgid -> rxc for that call; nil when closed
callID
int64
// ID for next call; incremented at every call
callID
int64
// ID for next call; incremented at every call
// ready after serveTab and notifyTab are initialized
serveReady
chan
struct
{}
// methods peer can invoke
// methods peer can invoke
serveReady
chan
struct
{}
// ready after serveTab and notifyTab are initialized by user
// methods are served in parallel
// methods are served in parallel
serveTab
map
[
string
]
func
(
context
.
Context
,
interface
{})
interface
{}
serveTab
map
[
string
]
func
(
context
.
Context
,
interface
{})
interface
{}
// notifications peer can send
// notifications peer can send
// notifications are invoked in order
// notifications are invoked in
received
order
notifyTab
map
[
string
]
func
(
interface
{})
error
notifyTab
map
[
string
]
func
(
interface
{})
error
serveWg
sync
.
WaitGroup
// for serveRecv and serveTab spawned from it
serveWg
sync
.
WaitGroup
// for serveRecv and serveTab spawned from it
...
@@ -95,11 +96,12 @@ func (zl *zLink) start() {
...
@@ -95,11 +96,12 @@ func (zl *zLink) start() {
//
//
// XXX it would be better for zLink to instead provide .Recv() to receive
// XXX it would be better for zLink to instead provide .Recv() to receive
// peer's requests and then serve is just loop over Recv and decide what to do
// peer's requests and then serve is just loop over Recv and decide what to do
// with messages.
// with messages
by zlink user, not here
.
func
(
zl
*
zLink
)
Serve
(
func
(
zl
*
zLink
)
Serve
(
notifyTab
map
[
string
]
func
(
interface
{})
error
,
notifyTab
map
[
string
]
func
(
interface
{})
error
,
serveTab
map
[
string
]
func
(
context
.
Context
,
interface
{})
interface
{},
serveTab
map
[
string
]
func
(
context
.
Context
,
interface
{})
interface
{},
)
error
{
)
error
{
// initialize serve tabs and indicate that serve is ready
zl
.
serveTab
=
serveTab
zl
.
serveTab
=
serveTab
zl
.
notifyTab
=
notifyTab
zl
.
notifyTab
=
notifyTab
close
(
zl
.
serveReady
)
close
(
zl
.
serveReady
)
...
@@ -110,7 +112,7 @@ func (zl *zLink) Serve(
...
@@ -110,7 +112,7 @@ func (zl *zLink) Serve(
var
errLinkClosed
=
errors
.
New
(
"zlink is closed"
)
var
errLinkClosed
=
errors
.
New
(
"zlink is closed"
)
// shutdown shuts zlink down and sets reason why the link was shut down.
// shutdown shuts zlink down and sets reason
of
why the link was shut down.
func
(
zl
*
zLink
)
shutdown
(
err
error
)
{
func
(
zl
*
zLink
)
shutdown
(
err
error
)
{
zl
.
down1
.
Do
(
func
()
{
zl
.
down1
.
Do
(
func
()
{
err2
:=
zl
.
link
.
Close
()
err2
:=
zl
.
link
.
Close
()
...
@@ -121,10 +123,8 @@ func (zl *zLink) shutdown(err error) {
...
@@ -121,10 +123,8 @@ func (zl *zLink) shutdown(err error) {
log
.
Printf
(
"%s: %s"
,
zl
.
link
.
RemoteAddr
(),
err
)
log
.
Printf
(
"%s: %s"
,
zl
.
link
.
RemoteAddr
(),
err
)
}
}
zl
.
errDown
=
err
zl
.
errDown
=
err
zl
.
serveCancel
()
zl
.
serveCancel
()
// notify call waiters
// notify call waiters
zl
.
callMu
.
Lock
()
zl
.
callMu
.
Lock
()
callTab
:=
zl
.
callTab
callTab
:=
zl
.
callTab
...
...
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