Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
b9efdbbb
Commit
b9efdbbb
authored
Jun 06, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0f398ab8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
wcfs/wcfs.go
wcfs/wcfs.go
+15
-5
No files found.
wcfs/wcfs.go
View file @
b9efdbbb
...
...
@@ -594,7 +594,7 @@ type WatchLink struct {
byfile
map
[
zodb
.
Oid
]
*
Watch
// {} foid -> Watch
// IO
reqNext
uint64
// stream ID for next wcfs-originated request
reqNext
uint64
// stream ID for next wcfs-originated request
; 0 is reserved for control messages
txMu
sync
.
Mutex
rxMu
sync
.
Mutex
rxTab
map
[
/*stream*/
uint64
]
chan
string
// client replies go via here
...
...
@@ -1498,6 +1498,7 @@ func (wlink *WatchLink) serve() {
}
// XXX locking
delete
(
wlink
.
head
.
wlinkTab
,
wlink
)
// XXX deactiwate all watches from wlink.byfile[*]
}
func
(
wlink
*
WatchLink
)
_serve
()
(
err
error
)
{
...
...
@@ -1514,9 +1515,15 @@ func (wlink *WatchLink) _serve() (err error) {
err
=
err2
}
// XXX write to peer if it was logical error on client side
// XXX on which stream? -1? -> better 0 as in HTTP/2?
// XXX then -> CloseWrite
// write to peer if it was logical error on client side
// then .sk.tx to wakeup rx on client side
if
err
!=
nil
{
_
=
wlink
.
send
(
ctx
,
0
,
fmt
.
Sprintf
(
"error: %s"
,
err
))
}
err2
=
wlink
.
sk
.
CloseWrite
()
if
err
==
nil
{
err
=
err2
}
}()
// close .sk.rx on error/wcfs stopping or return. closing .sk.rx wakes up read(sk)
...
...
@@ -1630,7 +1637,10 @@ func (wlink *WatchLink) _handleWatch(ctx context.Context, msg string) error {
// sendReq sends wcfs-originated request to client and returns client response.
func
(
wlink
*
WatchLink
)
sendReq
(
ctx
context
.
Context
,
req
string
)
(
reply
string
,
err
error
)
{
// XXX err ctx
stream
:=
atomic
.
AddUint64
(
&
wlink
.
reqNext
,
+
2
)
var
stream
uint64
for
stream
==
0
{
stream
=
atomic
.
AddUint64
(
&
wlink
.
reqNext
,
+
2
)
}
rxq
:=
make
(
chan
string
)
// XXX cap=1? (so that if we return canceled we do not block client)
wlink
.
rxMu
.
Lock
()
...
...
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