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
6bde31f8
Commit
6bde31f8
authored
Nov 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e95955e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
wcfs/internal/wcfs_watchlink.cpp
wcfs/internal/wcfs_watchlink.cpp
+19
-5
No files found.
wcfs/internal/wcfs_watchlink.cpp
View file @
6bde31f8
...
@@ -24,6 +24,13 @@
...
@@ -24,6 +24,13 @@
#include <golang/fmt.h>
#include <golang/fmt.h>
#include <string.h>
#include <string.h>
// XXX temp, place, ok=?
const
char
*
v
(
error
err
)
{
if
(
err
!=
nil
)
return
err
->
Error
().
c_str
();
// XXX Error() gives temp. obj
return
"nil"
;
}
_WatchLink
::
_WatchLink
()
{}
_WatchLink
::
_WatchLink
()
{}
_WatchLink
::~
_WatchLink
()
{}
_WatchLink
::~
_WatchLink
()
{}
void
_WatchLink
::
decref
()
{
void
_WatchLink
::
decref
()
{
...
@@ -93,7 +100,11 @@ error _WatchLink::close() {
...
@@ -93,7 +100,11 @@ error _WatchLink::close() {
if
(
err
==
context
::
canceled
)
if
(
err
==
context
::
canceled
)
err
=
nil
;
err
=
nil
;
printf
(
"close -> err =%s
\n
"
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
printf
(
"close -> err =%s
\n
"
,
v
(
err
));
error
err2
=
wlink
.
_f
->
close
();
error
err2
=
wlink
.
_f
->
close
();
printf
(
"close -> err2=%s
\n
"
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
if
(
err
==
nil
)
if
(
err
==
nil
)
err
=
err2
;
err
=
err2
;
...
@@ -124,18 +135,21 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
...
@@ -124,18 +135,21 @@ error _WatchLink::_serveRX(context::Context ctx) { // XXX error -> where ?
// NOTE: .close() makes sure .f.read*() will wake up
// NOTE: .close() makes sure .f.read*() will wake up
printf
(
"serveRX -> readline ...
\n
"
);
printf
(
"serveRX -> readline ...
\n
"
);
tie
(
l
,
err
)
=
wlink
.
_readline
();
// XXX +maxlen
tie
(
l
,
err
)
=
wlink
.
_readline
();
// XXX +maxlen
printf
(
" readline -> woken up; l='%s' ; err='%s'
\n
"
,
l
.
c_str
(),
printf
(
" readline -> woken up; l='%s' ; err='%s'
\n
"
,
l
.
c_str
(),
v
(
err
));
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
if
(
err
==
io
::
EOF_
)
{
// peer closed its tx
if
(
err
==
io
::
EOF_
)
{
// peer closed its tx
// XXX what happens on other errors?
// XXX what happens on other errors?
wlink
.
_rx_eof
.
close
();
wlink
.
_rx_eof
.
close
();
}
}
if
(
err
!=
nil
)
if
(
err
!=
nil
)
{
// XXX place=ok?
if
(
err
==
io
::
EOF_
)
err
=
nil
;
return
err
;
return
err
;
}
printf
(
"C: watch : rx: %s"
,
l
.
c_str
());
printf
(
"C: watch : rx: %s"
,
l
.
c_str
());
err
=
pkt
.
from_string
(
l
);
err
=
pkt
.
from_string
(
l
);
printf
(
"line -> pkt: err='%s'
\n
"
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
printf
(
"line -> pkt: err='%s'
\n
"
,
v
(
err
));
if
(
err
!=
nil
)
if
(
err
!=
nil
)
return
err
;
return
err
;
...
@@ -366,7 +380,7 @@ tuple<string, error> _WatchLink::_readline() {
...
@@ -366,7 +380,7 @@ tuple<string, error> _WatchLink::_readline() {
error
err
;
error
err
;
printf
(
"
\t
_readline -> read ...
\n
"
);
printf
(
"
\t
_readline -> read ...
\n
"
);
tie
(
n
,
err
)
=
wlink
.
_f
->
read
(
buf
,
sizeof
(
buf
));
tie
(
n
,
err
)
=
wlink
.
_f
->
read
(
buf
,
sizeof
(
buf
));
printf
(
"
\t
_readline -> read: n=%d err='%s'
\n
"
,
n
,
(
err
!=
nil
?
err
->
Error
().
c_str
()
:
"nil"
));
printf
(
"
\t
_readline -> read: n=%d err='%s'
\n
"
,
n
,
v
(
err
));
if
(
n
>
0
)
{
if
(
n
>
0
)
{
// XXX limit line length to avoid DoS
// XXX limit line length to avoid DoS
wlink
.
_rxbuf
+=
string
(
buf
,
n
);
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