Commit b9009ed2 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent aea23d6c
......@@ -52,6 +52,10 @@ type NEOSrv interface {
URL() string // zurl to access this NEO server
Bugs() []string // list of known server bugs
// BugEncFixed reports whether server, instead of autodetection,
// supports only fixed encoding, and, if yes, which one.
BugEncFixed() (bool, proto.Encoding)
}
// NEOSrvOptions represents options for a NEO server.
......@@ -81,7 +85,11 @@ type NEOPySrv struct {
}
func (_ *NEOPySrv) Bugs() []string {
return []string{}
return []string{"encfixed"}
}
func (_ *NEOPySrv) BugEncFixed() (bool, proto.Encoding) {
return true, 'N' // NEO/py 1.12
}
// StartNEOPySrv starts NEO/py server specified by options.
......@@ -209,6 +217,10 @@ func (_ *NEOGoSrv) Bugs() []string {
return []string{"nocommit"}
}
func (_ *NEOGoSrv) BugEncFixed() (bool, proto.Encoding) {
return false, 0 // NEO/go server autodetects client encoding
}
// StartNEOGoSrv starts NEO/go server specified by options.
func StartNEOGoSrv(opt NEOSrvOptions) (_ *NEOGoSrv, err error) {
defer xerr.Contextf(&err, "start neo/go %s/%s", opt.workdir, opt.name)
......@@ -537,7 +549,24 @@ func TestEncAutodetect(t *testing.T) {
neonet.DialEncTryOrder = encv
ndrv, _, err := neoOpen(nsrv.URL(),
&zodb.DriverOptions{ReadOnly: true}); X(err)
err = ndrv.Close(); X(err)
defer func() {
err := ndrv.Close(); X(err)
}()
// verify that link was established with either:
// - encv[0] encoding (NEO/go = server supports autodetection)
// - server encoding (NEO/py)
encOK := encv[0]
noautodetect, srvEnc := nsrv.BugEncFixed()
if noautodetect {
encOK = srvEnc
}
mlink, err := ndrv.masterLink(context.Background()); X(err)
enc := mlink.Encoding()
if enc != encOK {
t.Fatalf("connected with encoding %c ; want %c", enc, encOK)
}
})
}
})
......
......@@ -166,6 +166,12 @@ type NodeLink struct {
rxghandoff chan struct{}
}
// Encoding returns protocol encoding with which the link was handshaked. XXX
// XXX place
func (nl *NodeLink) Encoding() proto.Encoding {
return nl.enc
}
// XXX rx handoff make latency better for serial request-reply scenario but
// does a lot of harm for case when there are several parallel requests -
// serveRecv after handing off is put to tail of current cpu runqueue - not
......
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