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
9b5e6cdd
Commit
9b5e6cdd
authored
Apr 22, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maintain a last-seen time for connected BASP nodes
(cherry picked from commit
b00983e6
)
parent
d14154c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
libcaf_io/caf/io/basp/endpoint_context.hpp
libcaf_io/caf/io/basp/endpoint_context.hpp
+8
-6
libcaf_io/caf/io/basp_broker.hpp
libcaf_io/caf/io/basp_broker.hpp
+1
-0
libcaf_io/src/io/basp_broker.cpp
libcaf_io/src/io/basp_broker.cpp
+4
-1
No files found.
libcaf_io/caf/io/basp/endpoint_context.hpp
View file @
9b5e6cdd
...
...
@@ -6,14 +6,14 @@
#include <unordered_map>
#include "caf/response_promise.hpp"
#include "caf/variant.hpp"
#include "caf/io/connection_handle.hpp"
#include "caf/io/datagram_handle.hpp"
#include "caf/actor_clock.hpp"
#include "caf/io/basp/connection_state.hpp"
#include "caf/io/basp/header.hpp"
#include "caf/io/connection_handle.hpp"
#include "caf/io/datagram_handle.hpp"
#include "caf/response_promise.hpp"
#include "caf/timestamp.hpp"
#include "caf/variant.hpp"
namespace
caf
::
io
::
basp
{
...
...
@@ -32,6 +32,8 @@ struct endpoint_context {
uint16_t
local_port
;
// pending operations to be performed after handshake completed
optional
<
response_promise
>
callback
;
// keeps track of when we've last received a message from this endpoint
actor_clock
::
time_point
last_seen
;
};
}
// namespace caf::io::basp
libcaf_io/caf/io/basp_broker.hpp
View file @
9b5e6cdd
...
...
@@ -97,6 +97,7 @@ public:
void
learned_new_node
(
const
node_id
&
nid
);
/// Sets `this_context` by either creating or accessing state for `hdl`.
/// Automatically sets `endpoint_context::last_seen` to `clock().now()`.
void
set_context
(
connection_handle
hdl
);
/// Cleans up any state for `hdl`.
...
...
libcaf_io/src/io/basp_broker.cpp
View file @
9b5e6cdd
...
...
@@ -587,6 +587,7 @@ void basp_broker::learned_new_node_indirectly(const node_id& nid) {
void
basp_broker
::
set_context
(
connection_handle
hdl
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
auto
now
=
clock
().
now
();
auto
i
=
ctx
.
find
(
hdl
);
if
(
i
==
ctx
.
end
())
{
CAF_LOG_DEBUG
(
"create new BASP context:"
<<
CAF_ARG
(
hdl
));
...
...
@@ -598,8 +599,10 @@ void basp_broker::set_context(connection_handle hdl) {
invalid_actor_id
};
i
=
ctx
.
emplace
(
hdl
,
basp
::
endpoint_context
{
basp
::
await_header
,
hdr
,
hdl
,
node_id
{},
0
,
0
,
none
})
node_id
{},
0
,
0
,
none
,
now
})
.
first
;
}
else
{
i
->
second
.
last_seen
=
now
;
}
this_context
=
&
i
->
second
;
t_last_hop
=
&
i
->
second
.
id
;
...
...
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