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
1d93cf63
Commit
1d93cf63
authored
Apr 25, 2018
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for autoconnect and fix related bugs
parent
a287b288
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
324 additions
and
231 deletions
+324
-231
libcaf_io/caf/io/basp/instance.hpp
libcaf_io/caf/io/basp/instance.hpp
+6
-2
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+7
-3
libcaf_io/src/routing_table.cpp
libcaf_io/src/routing_table.cpp
+1
-0
libcaf_io/test/automatic_connection.cpp
libcaf_io/test/automatic_connection.cpp
+170
-198
libcaf_io/test/basp.cpp
libcaf_io/test/basp.cpp
+140
-28
No files found.
libcaf_io/caf/io/basp/instance.hpp
View file @
1d93cf63
...
...
@@ -337,7 +337,8 @@ public:
return
false
;
}
// Close this connection if we already established communication.
if
(
tbl_
.
lookup
(
hdr
.
source_node
).
hdl
)
{
auto
lr
=
tbl_
.
lookup
(
hdr
.
source_node
);
if
(
lr
.
hdl
)
{
CAF_LOG_INFO
(
"close connection since we already have a "
"connection: "
<<
CAF_ARG
(
hdr
.
source_node
));
callee_
.
finalize_handshake
(
hdr
.
source_node
,
aid
,
sigs
);
...
...
@@ -345,7 +346,10 @@ public:
}
// Add this node to our contacts.
CAF_LOG_INFO
(
"new endpoint:"
<<
CAF_ARG
(
hdr
.
source_node
));
tbl_
.
add
(
hdr
.
source_node
,
hdl
);
if
(
lr
.
known
)
tbl_
.
handle
(
hdr
.
source_node
,
hdl
);
else
tbl_
.
add
(
hdr
.
source_node
,
hdl
);
auto
config_server
=
system
().
registry
().
get
(
atom
(
"ConfigServ"
));
anon_send
(
actor_cast
<
actor
>
(
config_server
),
put_atom
::
value
,
to_string
(
hdr
.
source_node
),
make_message
(
addrs
));
...
...
libcaf_io/src/basp_broker.cpp
View file @
1d93cf63
...
...
@@ -97,6 +97,11 @@ strong_actor_ptr basp_broker_state::make_proxy(node_id nid, actor_id aid) {
// payload received from a remote node; if a remote node A sends
// us a handle to a third node B, then we assume that A can tell us
// how to contact B.
// TODO: This should probably happen somewhere else, but is usually only
// performed in `finalize_handshake` which is only called on receipt
// of server handshakes.
if
(
this_context
->
id
==
none
)
this_context
->
id
=
instance
.
tbl
().
lookup
(
this_context
->
hdl
);
auto
lr
=
instance
.
tbl
().
lookup
(
nid
);
if
(
nid
!=
this_context
->
id
&&
!
lr
.
known
)
{
instance
.
tbl
().
add
(
nid
,
this_context
->
id
);
...
...
@@ -414,7 +419,6 @@ void basp_broker_state::establish_communication(const node_id& nid) {
// TODO: Split this by functionality, address query & connecting?
CAF_ASSERT
(
this_context
!=
nullptr
);
CAF_LOG_TRACE
(
CAF_ARG
(
nid
));
learned_new_node
(
nid
);
if
(
!
enable_automatic_connections
)
return
;
// this member function gets only called once, after adding a new
...
...
@@ -452,7 +456,7 @@ void basp_broker_state::establish_communication(const node_id& nid) {
});
basp
::
header
hdr
{
basp
::
message_type
::
dispatch_message
,
basp
::
header
::
named_receiver_flag
,
0
,
0
,
this_node
(),
nid
,
tmp
.
id
(),
invalid_actor_id
,
0
,
0
,
this_node
(),
*
origin
,
tmp
.
id
(),
invalid_actor_id
,
visit
(
seq_num_visitor
{
this
},
hdl
)};
instance
.
write
(
self
->
context
(),
get_buffer
(
hdl
),
hdr
,
&
writer
);
...
...
@@ -669,7 +673,7 @@ basp_broker_state::get_buffer(node_id nid) {
if
(
res
.
known
&&
res
.
hdl
)
{
return
get_buffer
(
*
res
.
hdl
);
}
auto
msgs
=
pending_connectivity
[
nid
];
auto
&
msgs
=
pending_connectivity
[
nid
];
msgs
.
emplace_back
();
return
msgs
.
back
();
}
...
...
libcaf_io/src/routing_table.cpp
View file @
1d93cf63
...
...
@@ -108,6 +108,7 @@ bool routing_table::handle(const node_id& nid,
if
(
i
==
node_information_base_
.
end
())
return
false
;
i
->
second
.
hdl
=
hdl
;
nid_by_hdl_
.
emplace
(
hdl
,
nid
);
return
true
;
}
...
...
libcaf_io/test/automatic_connection.cpp
View file @
1d93cf63
This diff is collapsed.
Click to expand it.
libcaf_io/test/basp.cpp
View file @
1d93cf63
This diff is collapsed.
Click to expand it.
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