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
1947eb4d
Commit
1947eb4d
authored
Nov 21, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4642983d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+4
-0
wcfs/internal/wcfs_watchlink.cpp
wcfs/internal/wcfs_watchlink.cpp
+9
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+6
-0
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
1947eb4d
...
...
@@ -133,6 +133,10 @@ error _File::_errno(const char *op) {
static
error
_pathError
(
const
char
*
op
,
const
string
&
path
,
int
syserr
)
{
char
ebuf
[
128
];
char
*
estr
=
strerror_r
(
syserr
,
ebuf
,
sizeof
(
ebuf
));
printf
(
"OP: '%s'
\n
"
,
op
);
printf
(
"PATH: '%s'
\n
"
,
path
.
c_str
());
printf
(
"ESTR: '%s'
\n
"
,
estr
);
return
fmt
::
errorf
(
"%s %s: %s"
,
op
,
path
.
c_str
(),
estr
);
}
...
...
wcfs/internal/wcfs_watchlink.cpp
View file @
1947eb4d
...
...
@@ -122,7 +122,10 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
while
(
1
)
{
// NOTE: .close() makes sure .f.read*() will wake up
printf
(
"serveRX -> readline ...
\n
"
);
tie
(
l
,
err
)
=
wlink
.
_readline
();
// XXX +maxlen
printf
(
"
\t
readline -> woken up; l='%s' ; err='%s'
\n
"
,
l
.
c_str
(),
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
if
(
err
==
io
::
EOF_
)
{
// peer closed its tx
// XXX what happens on other errors?
wlink
.
_rx_eof
.
close
();
...
...
@@ -217,6 +220,8 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
_WatchLink
*
wlink
=
this
;
// XXX err ctx
printf
(
"wlink sendReq '%s'
\n
"
,
req
.
c_str
());
rxPkt
rx
;
chan
<
rxPkt
>
rxq
;
error
err
;
...
...
@@ -224,10 +229,12 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
if
(
err
!=
nil
)
return
make_pair
(
""
,
err
);
printf
(
"
\t
wait ...
\n
"
);
int
_
=
select
({
ctx
->
done
().
recvs
(),
// 0
rxq
.
recvs
(
&
rx
),
// 1
});
printf
(
"
\t
woken up #%d
\n
"
,
_
);
if
(
_
==
0
)
return
make_pair
(
""
,
ctx
->
err
());
...
...
@@ -350,7 +357,9 @@ tuple<string, error> _WatchLink::_readline() {
int
n
;
error
err
;
printf
(
" _readline -> read ...
\n
"
);
tie
(
n
,
err
)
=
wlink
.
_f
->
read
(
buf
,
sizeof
(
buf
));
printf
(
" _readline -> read: n=%d err='%s'
\n
"
,
n
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
if
(
n
>
0
)
{
// XXX limit line length to avoid DoS
wlink
.
_rxbuf
+=
string
(
buf
,
n
);
...
...
wcfs/wcfs_test.py
View file @
1947eb4d
...
...
@@ -1198,11 +1198,17 @@ def test_wcfs_watch_robust():
at2
=
t
.
commit
(
zf
,
{
2
:
'c2'
})
# file not yet opened on wcfs
print
(
'
\
n
\
n
AAA'
)
wl
=
t
.
openwatch
()
print
(
'
\
n
\
n
BBB'
)
assert
wl
.
sendReq
(
timeout
(),
b"watch %s @%s"
%
(
h
(
zf
.
_p_oid
),
h
(
at1
)))
==
\
"error setup watch f<%s> @%s: "
%
(
h
(
zf
.
_p_oid
),
h
(
at1
))
+
\
"file not yet known to wcfs or is not a ZBigFile"
print
(
'
\
n
\
n
CCC'
)
wl
.
close
()
print
(
'
\
n
\
n
DDD'
)
return
# closeTX/bye cancels blocked pin handlers
f
=
t
.
open
(
zf
)
...
...
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