Commit bbdcf0b0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c09a1bc3
......@@ -468,7 +468,7 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
func (z *zeo) Close() error {
err := z.link.Close()
if z.watchq != nil {
if z.watchq != nil { // XXX -> into zlink.shutdown instead? (so it is closed after link is closed)?
close(z.watchq)
}
return err
......
......@@ -72,8 +72,8 @@ type zLink struct {
serveCtx context.Context // serveTab handlers are called with this ctx
serveCancel func() // to cancel serveCtx
down1 sync.Once
errClose error // error got from .link.Close()
down1 sync.Once
errClose error // error got from .link.Close()
ver string // protocol version in use (without "Z" or "M" prefix)
enc encoding // protocol encoding in use ('Z' or 'M')
......@@ -87,6 +87,11 @@ func (zl *zLink) start() {
go zl.serveRecv()
}
// StartServe starts serving calls from remote peer according to notifyTab and serveTab.
//
// 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
// with messages.
func (zl *zLink) StartServe(
notifyTab map[string]func(interface{}) error,
serveTab map[string]func(context.Context, interface{}) interface{},
......@@ -119,6 +124,7 @@ func (zl *zLink) shutdown(err error) {
rxc <- msg{arg: nil} // notify link was closed XXX ok? or err explicitly?
}
// XXX if err != nil -> watchq <- zodb.EventError{err}
// XXX close watcher
})
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment