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
d876da33
Commit
d876da33
authored
Jan 15, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
272e43bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
wcfs/internal/wcfs_watchlink.cpp
wcfs/internal/wcfs_watchlink.cpp
+8
-8
No files found.
wcfs/internal/wcfs_watchlink.cpp
View file @
d876da33
...
...
@@ -139,7 +139,7 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
// NOTE: .close() makes sure .f.read*() will wake up
//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",
v(l
), v(err));
if
(
err
==
io
::
EOF_
)
{
// peer closed its tx
// XXX what happens on other errors?
wlink
.
rx_eof
.
close
();
...
...
@@ -150,7 +150,7 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
err
=
nil
;
return
E
(
err
);
}
printf
(
"C: watch : rx:
\"
%s
\"
"
,
l
.
c_str
(
));
printf
(
"C: watch : rx:
\"
%s
\"
"
,
v
(
l
));
err
=
pkt
.
from_string
(
l
);
//printf("line -> pkt: err='%s'\n", v(err));
...
...
@@ -162,7 +162,7 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
if
(
pkt
.
stream
==
0
)
{
// control/fatal message from wcfs
// XXX print -> receive somewhere? XXX -> recvCtl ?
printf
(
"C: watch : rx fatal: %s
\n
"
,
l
.
c_str
(
));
printf
(
"C: watch : rx fatal: %s
\n
"
,
v
(
l
));
wlink
.
fatalv
.
push_back
(
pkt
.
to_string
());
continue
;
}
...
...
@@ -219,7 +219,7 @@ error _WatchLink::_send(StreamID stream, const string &msg) {
// XXX +errctx ?
if
(
msg
.
find
(
'\n'
)
!=
string
::
npos
)
panic
(
"msg has
\\
n"
);
string
pkt
=
fmt
::
sprintf
(
"%lu %s
\n
"
,
stream
,
msg
.
c_str
(
));
string
pkt
=
fmt
::
sprintf
(
"%lu %s
\n
"
,
stream
,
v
(
msg
));
return
wlink
->
_write
(
pkt
);
}
...
...
@@ -248,7 +248,7 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
_WatchLink
*
wlink
=
this
;
xerr
::
Contextf
E
(
"wlink X: sendReq"
);
// XXX wlink details
//printf("wlink sendReq '%s'\n",
req.c_str(
));
//printf("wlink sendReq '%s'\n",
v(req
));
rxPkt
rx
;
bool
ok
;
chan
<
rxPkt
>
rxq
;
...
...
@@ -269,7 +269,7 @@ pair<string, error> _WatchLink::sendReq(context::Context ctx, const string &req)
if
(
!
ok
)
return
make_pair
(
""
,
E
(
io
::
ErrUnexpectedEOF
));
// XXX error ok?
string
reply
=
rx
.
to_string
();
//printf("sendReq: reply='%s'\n",
reply.c_str(
));
//printf("sendReq: reply='%s'\n",
v(reply
));
return
make_pair
(
reply
,
nil
);
}
...
...
@@ -365,7 +365,7 @@ static error _parsePinReq(PinReq *pin, const rxPkt *pkt) {
pin
->
stream
=
pkt
->
stream
;
string
msg
=
pkt
->
to_string
();
pin
->
msg
=
msg
;
//printf("'%s'\n",
msg.c_str(
));
//printf("'%s'\n",
v(msg
));
//printf("has_prefix: %i\n", strings::has_prefix(msg, "pin "));
xerr
::
Contextf
E
(
"bad pin: '%s'"
,
v
(
msg
));
...
...
@@ -416,7 +416,7 @@ 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",
v(line
));
return
make_tuple
(
line
,
nil
);
}
nl_searchfrom
=
wlink
.
_rxbuf
.
length
();
...
...
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