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
0a321cf9
Commit
0a321cf9
authored
Sep 17, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with multiple connections to same node
parent
ad651cd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+22
-22
No files found.
libcaf_io/src/basp_broker.cpp
View file @
0a321cf9
...
@@ -414,15 +414,19 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -414,15 +414,19 @@ basp_broker::handle_basp_header(connection_context& ctx,
}
}
auto
&
ifs
=
*
(
ctx
.
handshake_data
->
expected_ifs
);
auto
&
ifs
=
*
(
ctx
.
handshake_data
->
expected_ifs
);
if
(
!
std
::
includes
(
ifs
.
begin
(),
ifs
.
end
(),
if
(
!
std
::
includes
(
ifs
.
begin
(),
ifs
.
end
(),
remote_ifs
.
begin
(),
remote_ifs
.
end
()))
{
remote_ifs
.
begin
(),
remote_ifs
.
end
()))
{
auto
tostr
=
[](
const
std
::
set
<
string
>&
what
)
->
string
{
auto
tostr
=
[](
const
std
::
set
<
string
>&
what
)
->
string
{
if
(
what
.
empty
())
return
"actor"
;
if
(
what
.
empty
())
{
return
"actor"
;
}
string
tmp
;
string
tmp
;
tmp
=
"typed_actor<"
;
tmp
=
"typed_actor<"
;
auto
i
=
what
.
begin
();
auto
i
=
what
.
begin
();
auto
e
=
what
.
end
();
auto
e
=
what
.
end
();
tmp
+=
*
i
++
;
tmp
+=
*
i
++
;
while
(
i
!=
e
)
tmp
+=
*
i
++
;
while
(
i
!=
e
)
{
tmp
+=
*
i
++
;
}
tmp
+=
">"
;
tmp
+=
">"
;
return
tmp
;
return
tmp
;
};
};
...
@@ -431,21 +435,21 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -431,21 +435,21 @@ basp_broker::handle_basp_header(connection_context& ctx,
auto
&
error_msg
=
*
(
ctx
.
handshake_data
->
error_msg
);
auto
&
error_msg
=
*
(
ctx
.
handshake_data
->
error_msg
);
if
(
ifs
.
empty
())
{
if
(
ifs
.
empty
())
{
error_msg
=
"expected remote actor to be a "
error_msg
=
"expected remote actor to be a "
"dynamically typed actor but found "
"dynamically typed actor but found "
"a strongly typed actor of type "
"a strongly typed actor of type "
+
iface_str
;
+
iface_str
;
}
}
else
if
(
remote_ifs
.
empty
())
{
else
if
(
remote_ifs
.
empty
())
{
error_msg
=
"expected remote actor to be a "
error_msg
=
"expected remote actor to be a "
"strongly typed actor of type "
"strongly typed actor of type "
+
expected_str
+
+
expected_str
+
" but found a dynamically typed actor"
;
" but found a dynamically typed actor"
;
}
else
{
}
else
{
error_msg
=
"expected remote actor to be a "
error_msg
=
"expected remote actor to be a "
"strongly typed actor of type "
"strongly typed actor of type "
+
expected_str
+
+
expected_str
+
" but found a strongly typed actor of type "
" but found a strongly typed actor of type "
+
iface_str
;
+
iface_str
;
}
}
// abort with error
// abort with error
ctx
.
handshake_data
->
result
->
set_value
(
nullptr
);
ctx
.
handshake_data
->
result
->
set_value
(
nullptr
);
...
@@ -460,13 +464,9 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -460,13 +464,9 @@ basp_broker::handle_basp_header(connection_context& ctx,
return
close_connection
;
return
close_connection
;
}
}
if
(
!
try_set_default_route
(
nid
,
ctx
.
hdl
))
{
if
(
!
try_set_default_route
(
nid
,
ctx
.
hdl
))
{
CAF_LOG_INFO
(
"multiple connections to "
CAF_LOG_INFO
(
"multiple connections to "
<<
to_string
(
nid
)
<<
to_string
(
nid
)
<<
" (re-use old one)"
);
<<
" (re-use old one)"
);
auto
proxy
=
m_namespace
.
get_or_put
(
nid
,
remote_aid
);
auto
proxy
=
m_namespace
.
get
(
nid
,
remote_aid
);
CAF_LOG_INFO_IF
(
!
proxy
,
"no proxy for published actor found "
"although an open connection exists"
);
// discard this peer; there's already an open connection
// discard this peer; there's already an open connection
ctx
.
handshake_data
->
result
->
set_value
(
std
::
move
(
proxy
));
ctx
.
handshake_data
->
result
->
set_value
(
std
::
move
(
proxy
));
ctx
.
handshake_data
=
nullptr
;
ctx
.
handshake_data
=
nullptr
;
...
@@ -476,8 +476,8 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -476,8 +476,8 @@ basp_broker::handle_basp_header(connection_context& ctx,
auto
&
buf
=
wr_buf
(
ctx
.
hdl
);
auto
&
buf
=
wr_buf
(
ctx
.
hdl
);
binary_serializer
bs
(
std
::
back_inserter
(
buf
),
&
m_namespace
);
binary_serializer
bs
(
std
::
back_inserter
(
buf
),
&
m_namespace
);
write
(
bs
,
{
node
(),
ctx
.
handshake_data
->
remote_id
,
write
(
bs
,
{
node
(),
ctx
.
handshake_data
->
remote_id
,
invalid_actor_id
,
invalid_actor_id
,
invalid_actor_id
,
invalid_actor_id
,
0
,
basp
::
client_handshake
,
0
});
0
,
basp
::
client_handshake
,
0
});
// prepare to receive messages
// prepare to receive messages
auto
proxy
=
m_namespace
.
get_or_put
(
nid
,
remote_aid
);
auto
proxy
=
m_namespace
.
get_or_put
(
nid
,
remote_aid
);
ctx
.
published_actor
=
proxy
;
ctx
.
published_actor
=
proxy
;
...
...
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