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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
88f50882
Commit
88f50882
authored
Mar 10, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3cd2dd08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
wcfs/client/wcfs_watchlink.cpp
wcfs/client/wcfs_watchlink.cpp
+9
-2
wcfs/client/wcfs_watchlink.h
wcfs/client/wcfs_watchlink.h
+5
-5
No files found.
wcfs/client/wcfs_watchlink.cpp
View file @
88f50882
...
...
@@ -162,7 +162,7 @@ error _WatchLink::_serveRX(context::Context ctx) {
if
(
pkt
.
stream
==
0
)
{
// control/fatal message from wcfs
log
::
Errorf
(
"C: watch : rx fatal: %s
\n
"
,
v
(
l
));
wlink
.
fatalv
.
push_back
(
pkt
.
to_string
());
continue
;
// XXX -> shutdown ?
return
ErrLinkDown
;
// XXX correct error
}
bool
reply
=
(
pkt
.
stream
%
2
!=
0
);
...
...
@@ -227,8 +227,15 @@ error _WatchLink::recvReq(context::Context ctx, PinReq *prx) {
if
(
_
==
0
)
return
E
(
ctx
->
err
());
if
(
!
ok
)
if
(
!
ok
)
{
wlink
.
_rxmu
.
lock
();
bool
down
=
wlink
.
_rxdown
;
wlink
.
_rxmu
.
unlock
();
if
(
down
)
return
E
(
ErrLinkDown
);
return
io
::
EOF_
;
// NOTE EOF goes without E
}
return
E
(
_parsePinReq
(
prx
,
&
pkt
));
}
...
...
wcfs/client/wcfs_watchlink.h
View file @
88f50882
...
...
@@ -49,7 +49,7 @@ struct rxPkt {
StreamID
stream
;
// raw data received/to-be-sent.
// XXX not e.g. string as chan<T> currently does not support types with
// XXX not e.g. string
,
as chan<T> currently does not support types with
// non-trivial copy. Note: we anyway need to limit rx line length to
// avoid DoS, but just for DoS the limit would be higher.
uint16_t
datalen
;
...
...
@@ -58,12 +58,12 @@ struct rxPkt {
error
from_string
(
const
string
&
rx
);
string
to_string
()
const
;
};
static_assert
(
sizeof
(
rxPkt
)
==
256
,
"rxPkt miscompiled"
);
// NOTE 128 is too low for long error message
static_assert
(
sizeof
(
rxPkt
)
==
256
,
"rxPkt miscompiled"
);
// NOTE 128 is too low for long error message
// WatchLink represents /head/watch link opened on wcfs.
//
// It is created by WCFS
::
_openwatch().
// It is created by WCFS
.
_openwatch().
//
// .sendReq()/.recvReq() provides raw IO in terms of wcfs isolation protocol messages.
// .close() closes the link.
...
...
@@ -73,12 +73,12 @@ typedef refptr<class _WatchLink> WatchLink;
class
_WatchLink
:
public
object
{
WCFS
*
_wc
;
os
::
File
_f
;
// head/watch file handle
string
_rxbuf
;
// buffer for
read data
from _f
string
_rxbuf
;
// buffer for
data already read
from _f
// iso.protocol message IO
chan
<
rxPkt
>
_acceptq
;
// server originated messages go here
sync
::
Mutex
_rxmu
;
bool
_rxdown
;
bool
_rxdown
;
// y when the link is no-longer operational
dict
<
StreamID
,
chan
<
rxPkt
>>
_rxtab
;
// {} stream -> rxq server replies go via here
set
<
StreamID
>
_accepted
;
// streams we accepted but did not replied yet
...
...
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