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
2645c87a
Commit
2645c87a
authored
Mar 10, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
88f50882
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
wcfs/client/wcfs_watchlink.cpp
wcfs/client/wcfs_watchlink.cpp
+13
-4
No files found.
wcfs/client/wcfs_watchlink.cpp
View file @
2645c87a
...
...
@@ -86,6 +86,7 @@ error _WatchLink::close() {
//
// TODO -> better pthread_kill(SIGINT) instead of relying on wcfs proper behaviour?
error
err2
=
wlink
.
_serveWG
->
wait
();
// XXX getting ErrLinkDown from wait - ok?
if
(
errors
::
Is
(
err2
,
context
::
canceled
))
// canceled is expected and ok
err2
=
nil
;
...
...
@@ -130,7 +131,7 @@ error _WatchLink::_serveRX(context::Context ctx) {
defer
([
&
]()
{
wlink
.
_acceptq
.
close
();
wlink
.
_rxmu
.
lock
();
wlink
.
_rxdown
=
true
;
// don't allow new rxtab registers
wlink
.
_rxdown
=
true
;
// don't allow new rxtab registers
, mark the link as down
wlink
.
_rxmu
.
unlock
();
for
(
auto
_
:
wlink
.
_rxtab
)
{
// FIXME iterates without lock
auto
rxq
=
_
.
second
;
...
...
@@ -246,10 +247,13 @@ error _WatchLink::replyReq(context::Context ctx, const PinReq *req, const string
xerr
::
Contextf
E
(
"%s: replyReq .%d"
,
v
(
wlink
),
req
->
stream
);
wlink
.
_rxmu
.
lock
();
bool
ok
=
wlink
.
_accepted
.
has
(
req
->
stream
);
bool
ok
=
wlink
.
_accepted
.
has
(
req
->
stream
);
bool
down
=
wlink
.
_rxdown
;
wlink
.
_rxmu
.
unlock
();
if
(
!
ok
)
panic
(
"reply to not accepted stream"
);
if
(
down
)
return
E
(
ErrLinkDown
);
error
err
=
wlink
.
_send
(
req
->
stream
,
answer
);
...
...
@@ -290,8 +294,13 @@ pair</*reply*/string, error> _WatchLink::sendReq(context::Context ctx, const str
if
(
_
==
0
)
return
make_pair
(
""
,
E
(
ctx
->
err
()));
if
(
!
ok
)
return
make_pair
(
""
,
E
(
io
::
ErrUnexpectedEOF
));
if
(
!
ok
)
{
wlink
.
_rxmu
.
lock
();
bool
down
=
wlink
.
_rxdown
;
wlink
.
_rxmu
.
unlock
();
return
make_pair
(
""
,
E
(
down
?
ErrLinkDown
:
io
::
ErrUnexpectedEOF
));
}
string
reply
=
rx
.
to_string
();
return
make_pair
(
reply
,
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