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
b00983e6
Commit
b00983e6
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
parent
3ca105e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
libcaf_io/caf/io/basp/endpoint_context.hpp
libcaf_io/caf/io/basp/endpoint_context.hpp
+9
-7
libcaf_io/caf/io/basp_broker.hpp
libcaf_io/caf/io/basp_broker.hpp
+6
-6
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 @
b00983e6
...
@@ -20,14 +20,14 @@
...
@@ -20,14 +20,14 @@
#include <unordered_map>
#include <unordered_map>
#include "caf/variant.hpp"
#include "caf/actor_clock.hpp"
#include "caf/response_promise.hpp"
#include "caf/io/datagram_handle.hpp"
#include "caf/io/connection_handle.hpp"
#include "caf/io/basp/header.hpp"
#include "caf/io/basp/connection_state.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
{
namespace
caf
{
namespace
io
{
namespace
io
{
...
@@ -48,6 +48,8 @@ struct endpoint_context {
...
@@ -48,6 +48,8 @@ struct endpoint_context {
uint16_t
local_port
;
uint16_t
local_port
;
// pending operations to be performed after handshake completed
// pending operations to be performed after handshake completed
optional
<
response_promise
>
callback
;
optional
<
response_promise
>
callback
;
// keeps track of when we've last received a message from this endpoint
actor_clock
::
time_point
last_seen
;
};
};
}
// namespace basp
}
// namespace basp
...
...
libcaf_io/caf/io/basp_broker.hpp
View file @
b00983e6
...
@@ -18,24 +18,23 @@
...
@@ -18,24 +18,23 @@
#pragma once
#pragma once
#include <future>
#include <map>
#include <map>
#include <set>
#include <set>
#include <stack>
#include <stack>
#include <string>
#include <string>
#include <future>
#include <vector>
#include <unordered_map>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <vector>
#include "caf/stateful_actor.hpp"
#include "caf/proxy_registry.hpp"
#include "caf/binary_serializer.hpp"
#include "caf/binary_deserializer.hpp"
#include "caf/binary_deserializer.hpp"
#include "caf/binary_serializer.hpp"
#include "caf/forwarding_actor_proxy.hpp"
#include "caf/forwarding_actor_proxy.hpp"
#include "caf/io/basp/all.hpp"
#include "caf/io/basp/all.hpp"
#include "caf/io/broker.hpp"
#include "caf/io/broker.hpp"
#include "caf/io/typed_broker.hpp"
#include "caf/io/typed_broker.hpp"
#include "caf/proxy_registry.hpp"
#include "caf/stateful_actor.hpp"
namespace
caf
{
namespace
caf
{
namespace
io
{
namespace
io
{
...
@@ -108,6 +107,7 @@ public:
...
@@ -108,6 +107,7 @@ public:
void
learned_new_node
(
const
node_id
&
nid
);
void
learned_new_node
(
const
node_id
&
nid
);
/// Sets `this_context` by either creating or accessing state for `hdl`.
/// 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
);
void
set_context
(
connection_handle
hdl
);
/// Cleans up any state for `hdl`.
/// Cleans up any state for `hdl`.
...
...
libcaf_io/src/io/basp_broker.cpp
View file @
b00983e6
...
@@ -548,6 +548,7 @@ void basp_broker::learned_new_node_indirectly(const node_id& nid) {
...
@@ -548,6 +548,7 @@ void basp_broker::learned_new_node_indirectly(const node_id& nid) {
void
basp_broker
::
set_context
(
connection_handle
hdl
)
{
void
basp_broker
::
set_context
(
connection_handle
hdl
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
auto
now
=
clock
().
now
();
auto
i
=
ctx
.
find
(
hdl
);
auto
i
=
ctx
.
find
(
hdl
);
if
(
i
==
ctx
.
end
())
{
if
(
i
==
ctx
.
end
())
{
CAF_LOG_DEBUG
(
"create new BASP context:"
<<
CAF_ARG
(
hdl
));
CAF_LOG_DEBUG
(
"create new BASP context:"
<<
CAF_ARG
(
hdl
));
...
@@ -559,8 +560,10 @@ void basp_broker::set_context(connection_handle hdl) {
...
@@ -559,8 +560,10 @@ void basp_broker::set_context(connection_handle hdl) {
invalid_actor_id
};
invalid_actor_id
};
i
=
ctx
i
=
ctx
.
emplace
(
hdl
,
basp
::
endpoint_context
{
basp
::
await_header
,
hdr
,
hdl
,
.
emplace
(
hdl
,
basp
::
endpoint_context
{
basp
::
await_header
,
hdr
,
hdl
,
node_id
{},
0
,
0
,
none
})
node_id
{},
0
,
0
,
none
,
now
})
.
first
;
.
first
;
}
else
{
i
->
second
.
last_seen
=
now
;
}
}
this_context
=
&
i
->
second
;
this_context
=
&
i
->
second
;
t_last_hop
=
&
i
->
second
.
id
;
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