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
bb90dc01
Commit
bb90dc01
authored
Jan 12, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c31d9dbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+5
-6
go/zodb/zodbtools/watch_test.go
go/zodb/zodbtools/watch_test.go
+6
-6
No files found.
go/zodb/storage/zeo/zrpc.go
View file @
bb90dc01
// Copyright (C) 2018-20
19
Nexedi SA and Contributors.
// Copyright (C) 2018-20
20
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -31,14 +31,13 @@ import (
"net"
"sync"
"golang.org/x/sync/errgroup"
pickle
"github.com/kisielk/og-rek"
"github.com/someonegg/gocontainer/rbuf"
"lab.nexedi.com/kirr/go123/xbytes"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xsync"
"lab.nexedi.com/kirr/neo/go/zodb/internal/pickletools"
)
...
...
@@ -447,10 +446,10 @@ func handshake(ctx context.Context, conn net.Conn) (_ *zLink, err error) {
// ready when/if handshake tx/rx exchange succeeds
hok
:=
make
(
chan
struct
{})
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
wg
:=
xsync
.
NewWorkGroup
(
ctx
)
// rx/tx handshake packet
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
// server first announces its preferred protocol
// it is e.g. "M5", "Z5", "Z4", "Z3101", ...
pkb
,
err
:=
zl
.
recvPkt
()
...
...
@@ -501,7 +500,7 @@ func handshake(ctx context.Context, conn net.Conn) (_ *zLink, err error) {
return
nil
})
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
select
{
case
<-
ctx
.
Done
()
:
// either ctx canceled from outside, or it is tx/rx problem.
...
...
go/zodb/zodbtools/watch_test.go
View file @
bb90dc01
// Copyright (C) 2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2019
-2020
Nexedi SA and Contributors.
//
Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
...
...
@@ -29,9 +29,9 @@ import (
"testing"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/xsync"
"lab.nexedi.com/kirr/neo/go/internal/xtesting"
"lab.nexedi.com/kirr/neo/go/zodb"
)
...
...
@@ -65,14 +65,14 @@ func TestWatch(t *testing.T) {
stor
,
err
:=
zodb
.
Open
(
bg
,
tfs
,
&
zodb
.
OpenOptions
{
ReadOnly
:
true
});
X
(
err
)
// spawn plain and verbose watchers
ctx
0
,
cancel
:=
context
.
WithCancel
(
bg
)
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx0
)
ctx
,
cancel
:=
context
.
WithCancel
(
bg
)
wg
:=
xsync
.
NewWorkGroup
(
ctx
)
// gowatch spawns Watch(verbose) and returns expectf() func that is
// connected to verify Watch output.
gowatch
:=
func
(
verbose
bool
)
/*expectf*/
func
(
format
string
,
argv
...
interface
{})
{
pr
,
pw
:=
io
.
Pipe
()
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
Watch
(
ctx
,
stor
,
pw
,
verbose
)
})
...
...
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