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
a9036d34
Commit
a9036d34
authored
Mar 03, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix path managemenet in broadcast scatterer
parent
1df98a63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
libcaf_core/caf/broadcast_scatterer.hpp
libcaf_core/caf/broadcast_scatterer.hpp
+23
-2
No files found.
libcaf_core/caf/broadcast_scatterer.hpp
View file @
a9036d34
...
@@ -70,8 +70,29 @@ public:
...
@@ -70,8 +70,29 @@ public:
typename
super
::
path_ptr
add_path
(
stream_slots
slots
,
typename
super
::
path_ptr
add_path
(
stream_slots
slots
,
strong_actor_ptr
target
)
override
{
strong_actor_ptr
target
)
override
{
CAF_LOG_TRACE
(
CAF_ARG
(
slots
)
<<
CAF_ARG
(
target
));
// Make sure we have state for the slot.
state_map_
.
emplace
(
slots
.
sender
,
path_state
{});
state_map_
.
emplace
(
slots
.
sender
,
path_state
{});
return
super
::
add_path
(
slots
,
target
);
// Append to `paths_`.
auto
index
=
this
->
paths_
.
size
();
auto
result
=
super
::
add_path
(
slots
,
target
);
if
(
result
==
nullptr
)
return
nullptr
;
// Make sure state_map_ and paths_ are always equally sorted, otherwise
// we'll run into UB when calling `zip_foreach`.
CAF_ASSERT
(
index
==
this
->
paths_
.
size
()
-
1
);
CAF_ASSERT
(
result
->
slots
==
slots
);
CAF_ASSERT
(
this
->
paths_
.
container
().
back
().
first
==
slots
.
sender
);
CAF_ASSERT
(
this
->
paths_
.
container
().
back
().
second
.
get
()
==
result
);
auto
&
ys
=
state_map_
.
container
();
if
(
ys
[
index
].
first
!=
slots
.
sender
)
{
auto
i
=
state_map_
.
find
(
slots
.
sender
);
CAF_ASSERT
(
i
!=
ys
.
end
());
CAF_ASSERT
(
std
::
distance
(
ys
.
begin
(),
i
)
>
static_cast
<
ptrdiff_t
>
(
index
));
using
std
::
swap
;
swap
(
ys
[
index
],
*
i
);
}
return
result
;
}
}
void
emit_batches
()
override
{
void
emit_batches
()
override
{
...
@@ -96,7 +117,7 @@ protected:
...
@@ -96,7 +117,7 @@ protected:
private:
private:
void
emit_batches_impl
(
bool
force_underfull
)
{
void
emit_batches_impl
(
bool
force_underfull
)
{
CAF_ASSERT
(
this
->
paths_
.
size
()
=
=
state_map_
.
size
());
CAF_ASSERT
(
this
->
paths_
.
size
()
<
=
state_map_
.
size
());
if
(
this
->
paths_
.
empty
())
if
(
this
->
paths_
.
empty
())
return
;
return
;
// Calculate the chunk size, i.e., how many more items we can put to our
// Calculate the chunk size, i.e., how many more items we can put to our
...
...
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