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
822dc4d0
Commit
822dc4d0
authored
Feb 10, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused blacklist from routing table
parent
c42dcaf0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
32 deletions
+11
-32
libcaf_io/caf/io/basp/routing_table.hpp
libcaf_io/caf/io/basp/routing_table.hpp
+0
-4
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+1
-10
libcaf_io/src/routing_table.cpp
libcaf_io/src/routing_table.cpp
+10
-18
No files found.
libcaf_io/caf/io/basp/routing_table.hpp
View file @
822dc4d0
...
@@ -73,9 +73,6 @@ public:
...
@@ -73,9 +73,6 @@ public:
/// Adds a new indirect route to the table.
/// Adds a new indirect route to the table.
bool
add_indirect
(
const
node_id
&
hop
,
const
node_id
&
dest
);
bool
add_indirect
(
const
node_id
&
hop
,
const
node_id
&
dest
);
/// Blacklist the route to `dest` via `hop`.
void
blacklist
(
const
node_id
&
hop
,
const
node_id
&
dest
);
/// Removes a direct connection and calls `cb` for any node
/// Removes a direct connection and calls `cb` for any node
/// that became unreachable as a result of this operation,
/// that became unreachable as a result of this operation,
/// including the node that is assigned as direct path for `hdl`.
/// including the node that is assigned as direct path for `hdl`.
...
@@ -118,7 +115,6 @@ public:
...
@@ -118,7 +115,6 @@ public:
std
::
unordered_map
<
connection_handle
,
node_id
>
direct_by_hdl_
;
std
::
unordered_map
<
connection_handle
,
node_id
>
direct_by_hdl_
;
std
::
unordered_map
<
node_id
,
connection_handle
>
direct_by_nid_
;
std
::
unordered_map
<
node_id
,
connection_handle
>
direct_by_nid_
;
indirect_entries
indirect_
;
indirect_entries
indirect_
;
indirect_entries
blacklist_
;
};
};
/// @}
/// @}
...
...
libcaf_io/src/basp_broker.cpp
View file @
822dc4d0
...
@@ -68,19 +68,10 @@ strong_actor_ptr basp_broker_state::make_proxy(node_id nid, actor_id aid) {
...
@@ -68,19 +68,10 @@ 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
// 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 offers a route to B
// us a handle to a third node B, then we assume that A offers a route to B
if
(
nid
!=
this_context
->
id
if
(
nid
!=
this_context
->
id
&&
!
instance
.
tbl
().
lookup_direct
(
nid
)
&&
instance
.
tbl
().
add_indirect
(
this_context
->
id
,
nid
))
&&
instance
.
tbl
().
add_indirect
(
this_context
->
id
,
nid
))
learned_new_node_indirectly
(
nid
);
learned_new_node_indirectly
(
nid
);
// we need to tell remote side we are watching this actor now;
// we need to tell remote side we are watching this actor now;
// use a direct route if possible, i.e., when talking to a third node
// use a direct route if possible, i.e., when talking to a third node
auto
path
=
instance
.
tbl
().
lookup
(
nid
);
if
(
!
path
)
{
// this happens if and only if we don't have a path to `nid`
// and current_context_->hdl has been blacklisted
CAF_LOG_DEBUG
(
"cannot create a proxy instance for an actor "
"running on a node we don't have a route to"
);
return
nullptr
;
}
// create proxy and add functor that will be called if we
// create proxy and add functor that will be called if we
// receive a basp::down_message
// receive a basp::down_message
auto
mm
=
&
system
().
middleman
();
auto
mm
=
&
system
().
middleman
();
...
@@ -105,7 +96,7 @@ strong_actor_ptr basp_broker_state::make_proxy(node_id nid, actor_id aid) {
...
@@ -105,7 +96,7 @@ strong_actor_ptr basp_broker_state::make_proxy(node_id nid, actor_id aid) {
// tell remote side we are monitoring this actor now
// tell remote side we are monitoring this actor now
instance
.
write_monitor_message
(
self
->
context
(),
get_buffer
(
this_context
->
hdl
),
instance
.
write_monitor_message
(
self
->
context
(),
get_buffer
(
this_context
->
hdl
),
nid
,
aid
);
nid
,
aid
);
instance
.
flush
(
*
path
);
flush
(
this_context
->
hdl
);
mm
->
notify
<
hook
::
new_remote_actor
>
(
res
);
mm
->
notify
<
hook
::
new_remote_actor
>
(
res
);
return
res
;
return
res
;
}
}
...
...
libcaf_io/src/routing_table.cpp
View file @
822dc4d0
...
@@ -73,16 +73,6 @@ node_id routing_table::lookup_indirect(const node_id& nid) const {
...
@@ -73,16 +73,6 @@ node_id routing_table::lookup_indirect(const node_id& nid) const {
return
*
i
->
second
.
begin
();
return
*
i
->
second
.
begin
();
}
}
void
routing_table
::
blacklist
(
const
node_id
&
hop
,
const
node_id
&
dest
)
{
blacklist_
[
dest
].
emplace
(
hop
);
auto
i
=
indirect_
.
find
(
dest
);
if
(
i
==
indirect_
.
end
())
return
;
i
->
second
.
erase
(
hop
);
if
(
i
->
second
.
empty
())
indirect_
.
erase
(
i
);
}
void
routing_table
::
erase_direct
(
const
connection_handle
&
hdl
,
void
routing_table
::
erase_direct
(
const
connection_handle
&
hdl
,
erase_callback
&
cb
)
{
erase_callback
&
cb
)
{
auto
i
=
direct_by_hdl_
.
find
(
hdl
);
auto
i
=
direct_by_hdl_
.
find
(
hdl
);
...
@@ -115,15 +105,17 @@ void routing_table::add_direct(const connection_handle& hdl,
...
@@ -115,15 +105,17 @@ void routing_table::add_direct(const connection_handle& hdl,
}
}
bool
routing_table
::
add_indirect
(
const
node_id
&
hop
,
const
node_id
&
dest
)
{
bool
routing_table
::
add_indirect
(
const
node_id
&
hop
,
const
node_id
&
dest
)
{
auto
i
=
blacklist_
.
find
(
dest
);
// Never add indirect entries if we already have direct connection.
if
(
i
==
blacklist_
.
end
()
||
i
->
second
.
count
(
hop
)
==
0
)
{
if
(
lookup_direct
(
dest
)
!=
none
)
return
false
;
// Never add indirect entries if we don't have a connection to the hop.
if
(
lookup_direct
(
hop
)
==
none
)
return
false
;
auto
&
hops
=
indirect_
[
dest
];
auto
&
hops
=
indirect_
[
dest
];
auto
added_firs
t
=
hops
.
empty
();
auto
resul
t
=
hops
.
empty
();
hops
.
emplace
(
hop
);
if
(
hops
.
emplace
(
hop
).
second
)
parent_
->
parent
().
notify
<
hook
::
new_route_added
>
(
hop
,
dest
);
parent_
->
parent
().
notify
<
hook
::
new_route_added
>
(
hop
,
dest
);
return
added_first
;
return
result
;
}
return
false
;
// blacklisted
}
}
bool
routing_table
::
reachable
(
const
node_id
&
dest
)
{
bool
routing_table
::
reachable
(
const
node_id
&
dest
)
{
...
...
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