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
f2b1460c
Commit
f2b1460c
authored
Apr 22, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disconnect nodes when reaching connection_timeout
parent
801a458f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
libcaf_core/caf/sec.hpp
libcaf_core/caf/sec.hpp
+3
-1
libcaf_core/src/sec_strings.cpp
libcaf_core/src/sec_strings.cpp
+2
-0
libcaf_io/src/io/basp_broker.cpp
libcaf_io/src/io/basp_broker.cpp
+17
-3
No files found.
libcaf_core/caf/sec.hpp
View file @
f2b1460c
...
...
@@ -132,11 +132,13 @@ enum class sec : uint8_t {
malformed_basp_message
,
/// The middleman closed a connection because it failed to serialize or
/// deserialize a payload.
serializing_basp_payload_failed
,
serializing_basp_payload_failed
=
50
,
/// The middleman closed a connection to itself or an already connected node.
redundant_connection
,
/// Resolving a path on a remote node failed.
remote_lookup_failed
,
/// Disconnected from a BASP node after reaching the connection timeout.
connection_timeout
,
};
/// @relates sec
...
...
libcaf_core/src/sec_strings.cpp
View file @
f2b1460c
...
...
@@ -117,6 +117,8 @@ std::string to_string(sec x) {
return
"redundant_connection"
;
case
sec
:
:
remote_lookup_failed
:
return
"remote_lookup_failed"
;
case
sec
:
:
connection_timeout
:
return
"connection_timeout"
;
};
}
...
...
libcaf_io/src/io/basp_broker.cpp
View file @
f2b1460c
...
...
@@ -345,9 +345,9 @@ behavior basp_broker::make_behavior() {
}
auto
next_tick
=
scheduled
+
heartbeat_interval
;
if
(
now
>=
next_tick
)
{
CAF_LOG_ERROR
(
"Lagging a full heartbeat interval behind! Interval too low
"
"or BASP actor overloaded!
Other nodes may disconnect."
);
CAF_LOG_ERROR
(
"Lagging a full heartbeat interval behind! "
"Interval too low or BASP actor overloaded!
"
"
Other nodes may disconnect."
);
while
(
now
>=
next_tick
)
next_tick
+=
heartbeat_interval
;
...
...
@@ -357,6 +357,20 @@ behavior basp_broker::make_behavior() {
}
// Send out heartbeats.
instance
.
handle_heartbeat
(
context
());
// Check whether any node reached the disconnect timeout.
for
(
auto
i
=
ctx
.
begin
();
i
!=
ctx
.
end
();)
{
if
(
i
->
second
.
last_seen
+
connection_timeout
<
now
)
{
CAF_LOG_WARNING
(
"Disconnect BASP node: reached connection timeout!"
);
auto
hdl
=
i
->
second
.
hdl
;
// connection_cleanup below calls ctx.erase, so we need to increase
// the iterator now, before it gets invalidated.
++
i
;
connection_cleanup
(
hdl
,
sec
::
connection_timeout
);
close
(
hdl
);
}
else
{
++
i
;
}
}
// Schedule next tick.
scheduled_send
(
this
,
next_tick
,
tick_atom
::
value
,
next_tick
,
heartbeat_interval
,
connection_timeout
);
...
...
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