Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
076112c8
Commit
076112c8
authored
Jul 13, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of connection fails during handshake
parent
1003c017
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
libcaf_io/caf/io/basp_broker.hpp
libcaf_io/caf/io/basp_broker.hpp
+3
-1
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+19
-4
No files found.
libcaf_io/caf/io/basp_broker.hpp
View file @
076112c8
...
@@ -118,8 +118,10 @@ struct basp_broker_state : proxy_registry::backend, basp::instance::callee {
...
@@ -118,8 +118,10 @@ struct basp_broker_state : proxy_registry::backend, basp::instance::callee {
// protocol instance of BASP
// protocol instance of BASP
basp
::
instance
instance
;
basp
::
instance
instance
;
using
ctx_map
=
std
::
unordered_map
<
connection_handle
,
connection_context
>
;
// keeps context information for all open connections
// keeps context information for all open connections
std
::
unordered_map
<
connection_handle
,
connection_context
>
ctx
;
ctx_map
ctx
;
// points to the current context for callbacks such as `make_proxy`
// points to the current context for callbacks such as `make_proxy`
connection_context
*
this_context
=
nullptr
;
connection_context
*
this_context
=
nullptr
;
...
...
libcaf_io/src/basp_broker.cpp
View file @
076112c8
...
@@ -603,10 +603,25 @@ behavior basp_broker::make_behavior() {
...
@@ -603,10 +603,25 @@ behavior basp_broker::make_behavior() {
// hops to be resilient to (rare) network failures or if a
// hops to be resilient to (rare) network failures or if a
// node is reachable via several interfaces and only one fails
// node is reachable via several interfaces and only one fails
auto
nid
=
state
.
instance
.
tbl
().
lookup_direct
(
msg
.
handle
);
auto
nid
=
state
.
instance
.
tbl
().
lookup_direct
(
msg
.
handle
);
// tell BASP instance we've lost connection
if
(
nid
!=
none
)
{
state
.
instance
.
handle_node_shutdown
(
nid
);
// tell BASP instance we've lost connection
CAF_ASSERT
(
nid
==
none
state
.
instance
.
handle_node_shutdown
(
nid
);
||
!
state
.
instance
.
tbl
().
reachable
(
nid
));
}
else
{
// check whether the connection failed during handshake
auto
pred
=
[
&
](
const
basp_broker_state
::
ctx_map
::
value_type
&
x
)
{
return
x
.
second
.
hdl
==
msg
.
handle
;
};
auto
e
=
state
.
ctx
.
end
();
auto
i
=
std
::
find_if
(
state
.
ctx
.
begin
(),
e
,
pred
);
if
(
i
!=
e
)
{
auto
&
ref
=
i
->
second
;
if
(
ref
.
callback
)
{
CAF_LOG_DEBUG
(
"connection closed during handshake"
);
ref
.
callback
->
deliver
(
sec
::
disconnect_during_handshake
);
}
state
.
ctx
.
erase
(
i
);
}
}
},
},
// received from underlying broker implementation
// received from underlying broker implementation
[
=
](
const
acceptor_closed_msg
&
msg
)
{
[
=
](
const
acceptor_closed_msg
&
msg
)
{
...
...
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