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
f8d30e17
Commit
f8d30e17
authored
Mar 09, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0be25253
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
wcfs/client/wcfs_watchlink.cpp
wcfs/client/wcfs_watchlink.cpp
+8
-7
No files found.
wcfs/client/wcfs_watchlink.cpp
View file @
f8d30e17
...
...
@@ -135,9 +135,8 @@ error _WatchLink::_serveRX(context::Context ctx) {
while
(
1
)
{
// 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", v(l), v(err));
tie
(
l
,
err
)
=
wlink
.
_readline
();
//trace(" readline -> 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
();
...
...
@@ -416,19 +415,21 @@ 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", v(line));
//
trace
("\t_readline -> ret '%s'\n", v(line));
return
make_tuple
(
line
,
nil
);
}
nl_searchfrom
=
wlink
.
_rxbuf
.
length
();
int
n
;
error
err
;
//
printf
("\t_readline -> read ...\n");
//
trace
("\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));
//
trace
("\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
);
// limit line length to avoid DoS
if
(
wlink
.
_rxbuf
.
length
()
>
128
)
// XXX limit arbitrary
return
make_tuple
(
""
,
fmt
::
errorf
(
"line is too long"
));
continue
;
}
if
(
err
==
nil
)
...
...
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