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
92002789
Commit
92002789
authored
Nov 25, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
19303741
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
wcfs/internal/wcfs_watchlink.cpp
wcfs/internal/wcfs_watchlink.cpp
+13
-13
No files found.
wcfs/internal/wcfs_watchlink.cpp
View file @
92002789
...
...
@@ -100,11 +100,11 @@ error _WatchLink::close() {
if
(
err
==
context
::
canceled
)
err
=
nil
;
printf
(
"close -> err =%s
\n
"
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
printf
(
"close -> err =%s
\n
"
,
v
(
err
));
//
printf("close -> err =%s\n", (err != nil ? err->Error().c_str() : "nil"));
//
printf("close -> err =%s\n", v(err));
error
err2
=
wlink
.
_f
->
close
();
printf
(
"close -> err2=%s
\n
"
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
//
printf("close -> err2=%s\n", (err != nil ? err->Error().c_str() : "nil"));
if
(
err
==
nil
)
err
=
err2
;
...
...
@@ -133,9 +133,9 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
while
(
1
)
{
// NOTE: .close() makes sure .f.read*() will wake up
printf
(
"serveRX -> readline ...
\n
"
);
//
printf("serveRX -> readline ...\n");
tie
(
l
,
err
)
=
wlink
.
_readline
();
// XXX +maxlen
printf
(
" readline -> woken up; l='%s' ; err='%s'
\n
"
,
l
.
c_str
(),
v
(
err
));
//
printf(" readline -> woken up; l='%s' ; err='%s'\n", l.c_str(), v(err));
if
(
err
==
io
::
EOF_
)
{
// peer closed its tx
// XXX what happens on other errors?
wlink
.
_rx_eof
.
close
();
...
...
@@ -146,7 +146,7 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
err
=
nil
;
return
err
;
}
printf
(
"C: watch : rx:
%s
"
,
l
.
c_str
());
printf
(
"C: watch : rx:
\"
%s
\"
"
,
l
.
c_str
());
err
=
pkt
.
from_string
(
l
);
printf
(
"line -> pkt: err='%s'
\n
"
,
v
(
err
));
...
...
@@ -239,7 +239,7 @@ 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
());
//
printf("wlink sendReq '%s'\n", req.c_str());
rxPkt
rx
;
chan
<
rxPkt
>
rxq
;
...
...
@@ -248,18 +248,18 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
if
(
err
!=
nil
)
return
make_pair
(
""
,
err
);
printf
(
"sendReq: wait ...
\n
"
);
//
printf("sendReq: wait ...\n");
int
_
=
select
({
ctx
->
done
().
recvs
(),
// 0
rxq
.
recvs
(
&
rx
),
// 1
});
printf
(
"sendReq: woken up #%d
\n
"
,
_
);
//
printf("sendReq: woken up #%d\n", _);
if
(
_
==
0
)
return
make_pair
(
""
,
ctx
->
err
());
// XXX check for EOF
string
reply
=
rx
.
to_string
();
printf
(
"sendReq: reply='%s'
\n
"
,
reply
.
c_str
());
//
printf("sendReq: reply='%s'\n", reply.c_str());
return
make_pair
(
reply
,
nil
);
}
...
...
@@ -371,16 +371,16 @@ tuple<string, error> _WatchLink::_readline() {
if
(
nl
!=
string
::
npos
)
{
auto
line
=
wlink
.
_rxbuf
.
substr
(
0
,
nl
+
1
);
wlink
.
_rxbuf
=
wlink
.
_rxbuf
.
substr
(
nl
+
1
);
printf
(
"
\t
_readline -> ret '%s'
\n
"
,
line
.
c_str
());
//
printf("\t_readline -> ret '%s'\n", line.c_str());
return
make_tuple
(
line
,
nil
);
}
nl_searchfrom
=
wlink
.
_rxbuf
.
length
();
int
n
;
error
err
;
printf
(
"
\t
_readline -> read ...
\n
"
);
//
printf("\t_readline -> read ...\n");
tie
(
n
,
err
)
=
wlink
.
_f
->
read
(
buf
,
sizeof
(
buf
));
printf
(
"
\t
_readline -> read: n=%d err='%s'
\n
"
,
n
,
v
(
err
));
//
printf("\t_readline -> read: n=%d err='%s'\n", n, v(err));
if
(
n
>
0
)
{
// XXX limit line length to avoid DoS
wlink
.
_rxbuf
+=
string
(
buf
,
n
);
...
...
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