Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
e507f6d7
Commit
e507f6d7
authored
Jul 03, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
88155c17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+19
-4
No files found.
go/zodb/storage/zeo/zrpc.go
View file @
e507f6d7
...
...
@@ -72,7 +72,8 @@ type zLink struct {
down1
sync
.
Once
errClose
error
// error got from .link.Close()
ver
string
// protocol verision in use (without "Z" or "M" prefix)
ver
string
// protocol version in use (without "Z" or "M" prefix)
encoding
byte
// protocol encoding in use ('Z' or 'M')
}
// (called after handshake)
...
...
@@ -136,7 +137,7 @@ func (zl *zLink) serveRecv() {
// serveRecv1 handles 1 incoming packet.
func
(
zl
*
zLink
)
serveRecv1
(
pkb
*
pktBuf
)
error
{
// decode packet
m
,
err
:=
pktDecode
(
pkb
)
m
,
err
:=
zl
.
pktDecode
(
pkb
)
if
err
!=
nil
{
return
err
}
...
...
@@ -189,8 +190,17 @@ func derrf(format string, argv ...interface{}) error {
return
fmt
.
Errorf
(
"decode: "
+
format
,
argv
...
)
}
// pktDecode decodes raw packet into message
func
pktDecode
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
// pktDecode decodes raw packet into message.
func
(
zl
*
zLink
)
pktDecode
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
switch
zl
.
encoding
{
case
'Z'
:
return
pktDecodeZ
(
pkb
)
case
'M'
:
return
pktDecodeM
(
pkb
)
default
:
panic
(
"bug"
)
}
}
// pktDecodeZ decodes raw Z (pickle) packet into message.
func
pktDecodeZ
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
var
m
msg
// must be (msgid, False|0, ".reply", res)
d
:=
pickle
.
NewDecoder
(
bytes
.
NewReader
(
pkb
.
Payload
()))
...
...
@@ -227,6 +237,11 @@ func pktDecode(pkb *pktBuf) (msg, error) {
return
m
,
nil
}
// pktDecodeM decodes raw M (msgpack) packet into message.
func
pktDecodeM
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
panic
(
"TODO"
)
}
// Call makes 1 RPC call to server, waits for reply and returns it.
func
(
zl
*
zLink
)
Call
(
ctx
context
.
Context
,
method
string
,
argv
...
interface
{})
(
reply
msg
,
_
error
)
{
...
...
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