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
b57ead03
Commit
b57ead03
authored
Dec 09, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure brokers stick to one backend
parent
065ad856
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
18 deletions
+14
-18
libcaf_io/caf/io/abstract_broker.hpp
libcaf_io/caf/io/abstract_broker.hpp
+4
-1
libcaf_io/src/io/abstract_broker.cpp
libcaf_io/src/io/abstract_broker.cpp
+10
-17
No files found.
libcaf_io/caf/io/abstract_broker.hpp
View file @
b57ead03
...
...
@@ -365,7 +365,9 @@ public:
std
::
vector
<
connection_handle
>
connections
()
const
;
/// Returns the `multiplexer` running this broker.
network
::
multiplexer
&
backend
();
network
::
multiplexer
&
backend
()
{
return
*
backend_
;
}
protected:
void
init_broker
();
...
...
@@ -436,6 +438,7 @@ private:
get_map
(
hdl
).
emplace
(
hdl
,
std
::
move
(
ptr
));
}
network
::
multiplexer
*
backend_
=
nullptr
;
scribe_map
scribes_
;
doorman_map
doormen_
;
datagram_servant_map
datagram_servants_
;
...
...
libcaf_io/src/io/abstract_broker.cpp
View file @
b57ead03
...
...
@@ -18,39 +18,36 @@
#include "caf/actor_system.hpp"
#include "caf/config.hpp"
#include "caf/detail/scope_guard.hpp"
#include "caf/detail/sync_request_bouncer.hpp"
#include "caf/event_based_actor.hpp"
#include "caf/io/broker.hpp"
#include "caf/io/network/multiplexer.hpp"
#include "caf/logger.hpp"
#include "caf/make_counted.hpp"
#include "caf/none.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/span.hpp"
#include "caf/io/broker.hpp"
#include "caf/io/middleman.hpp"
#include "caf/detail/scope_guard.hpp"
#include "caf/detail/sync_request_bouncer.hpp"
#include "caf/event_based_actor.hpp"
namespace
caf
::
io
{
void
abstract_broker
::
enqueue
(
strong_actor_ptr
src
,
message_id
mid
,
message
msg
,
execution_unit
*
)
{
enqueue
(
make_mailbox_element
(
std
::
move
(
src
),
mid
,
{},
std
::
move
(
msg
)),
&
backend
()
);
backend_
);
}
void
abstract_broker
::
enqueue
(
mailbox_element_ptr
ptr
,
execution_unit
*
)
{
CAF_PUSH_AID
(
id
());
scheduled_actor
::
enqueue
(
std
::
move
(
ptr
),
&
backend
()
);
scheduled_actor
::
enqueue
(
std
::
move
(
ptr
),
backend_
);
}
void
abstract_broker
::
launch
(
execution_unit
*
eu
,
bool
lazy
,
bool
hide
)
{
CAF_PUSH_AID_FROM_PTR
(
this
);
CAF_ASSERT
(
eu
!=
nullptr
);
CAF_ASSERT
(
eu
==
&
backend
());
CAF_ASSERT
(
dynamic_cast
<
network
::
multiplexer
*>
(
eu
)
!=
nullptr
);
backend_
=
static_cast
<
network
::
multiplexer
*>
(
eu
);
CAF_LOG_TRACE
(
CAF_ARG
(
lazy
)
<<
CAF_ARG
(
hide
));
// add implicit reference count held by middleman/multiplexer
if
(
!
hide
)
register_at_system
();
if
(
lazy
&&
mailbox
().
try_block
())
...
...
@@ -359,7 +356,7 @@ resumable::subtype_t abstract_broker::subtype() const {
resumable
::
resume_result
abstract_broker
::
resume
(
execution_unit
*
ctx
,
size_t
mt
)
{
CAF_ASSERT
(
ctx
!=
nullptr
);
CAF_ASSERT
(
ctx
==
&
backend
()
);
CAF_ASSERT
(
ctx
==
backend_
);
return
scheduled_actor
::
resume
(
ctx
,
mt
);
}
...
...
@@ -380,10 +377,6 @@ abstract_broker::abstract_broker(actor_config& cfg) : scheduled_actor(cfg) {
// nop
}
network
::
multiplexer
&
abstract_broker
::
backend
()
{
return
system
().
middleman
().
backend
();
}
void
abstract_broker
::
launch_servant
(
doorman_ptr
&
ptr
)
{
// A doorman needs to be launched in addition to being initialized. This
// allows CAF to assign doorman to uninitialized brokers.
...
...
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