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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
487daf51
Commit
487daf51
authored
Apr 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ff4d2f6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
16 deletions
+33
-16
wcfs/wcfs.go
wcfs/wcfs.go
+31
-15
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+2
-1
No files found.
wcfs/wcfs.go
View file @
487daf51
...
...
@@ -1458,6 +1458,8 @@ func (wlink *WatchLink) _serveRX() (err error) {
defer
xerr
.
Contextf
(
&
err
,
"wlink %d: serve rx"
,
wlink
.
id
)
r
:=
bufio
.
NewReader
(
wlink
.
sk
)
// XXX close .sk on error/wcfs stopping
// XXX write to peer if it was logical error on client side
// XXX on which stream? -1?
...
...
@@ -1490,30 +1492,43 @@ func (wlink *WatchLink) _serveRX() (err error) {
}
// client-initiated watch request
foid
,
at
,
err
:=
parseWatch
(
msg
)
err
=
wlink
.
handleSetupWatch
(
stream
,
msg
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%d: %s"
,
stream
,
err
)
panic
(
err
)
// XXX
}
}
}
ctx
:=
context
.
TODO
()
// XXX ctx = ?
// handleSetupWatch handles watch request from client.
//
// returned error comes without full error prefix.
func
(
wlink
*
WatchLink
)
handleSetupWatch
(
stream
uint64
,
msg
string
)
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%d"
,
stream
)
fmt
.
Printf
(
"S: watch: AAA
\n
"
)
foid
,
at
,
err
:=
parseWatch
(
msg
)
if
err
!=
nil
{
return
err
}
err
=
wlink
.
setupWatch
(
ctx
,
foid
,
at
)
if
err
!=
nil
{
fmt
.
Printf
(
"S: watch: QQQ: %s
\n
"
,
err
)
return
fmt
.
Errorf
(
"%d: %s"
,
stream
,
err
)
}
ctx
:=
context
.
TODO
()
// XXX ctx = ?
fmt
.
Printf
(
"S: watch: BBB
\n
"
)
fmt
.
Printf
(
"S: watch: AAA
\n
"
)
err
=
wlink
.
send
(
ctx
,
stream
,
"ok"
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
err
=
wlink
.
setupWatch
(
ctx
,
foid
,
at
)
if
err
!=
nil
{
fmt
.
Printf
(
"S: watch: QQQ: %s
\n
"
,
err
)
return
err
}
fmt
.
Printf
(
"S: watch: CCC
\n
"
)
fmt
.
Printf
(
"S: watch: BBB
\n
"
)
err
=
wlink
.
send
(
ctx
,
stream
,
"ok"
)
if
err
!=
nil
{
return
err
}
fmt
.
Printf
(
"S: watch: CCC
\n
"
)
return
nil
}
// sendReq sends wcfs-originated request to client and returns client response.
...
...
@@ -1533,6 +1548,7 @@ func (wlink *WatchLink) sendReq(ctx context.Context, req string) (reply string,
select
{
case
<-
ctx
.
Done
()
:
// XXX del rxTab[stream] ?
return
""
,
ctx
.
Err
()
case
reply
=
<-
rxq
:
...
...
wcfs/wcfs_test.py
View file @
487daf51
...
...
@@ -443,7 +443,7 @@ class tWatch:
with
t
.
_txmu
:
pkt
=
b"%d %s
\
n
"
%
(
stream
,
msg
)
print
(
'C: watch: tx: %r'
%
pkt
)
t
.
wtx
.
write
(
pkt
)
# XXX read/write don't work in parallel?
t
.
wtx
.
write
(
pkt
)
t
.
wtx
.
flush
()
# sendReq sends client -> server request and returns server reply.
...
...
@@ -674,6 +674,7 @@ def test_wcfs():
# XXX read file[blk]=hole; then file[blk]=zblk - must be invalidated and
# setupWatch must send pins.
# XXX watch @at when file did not existed
def
test_wcfs_invproto
():
...
...
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