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
e9eb8ba4
Commit
e9eb8ba4
authored
Sep 29, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check whether buf_ is still valid before accessing
parent
0ab5fad6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
libcaf_net/caf/net/producer_adapter.hpp
libcaf_net/caf/net/producer_adapter.hpp
+14
-6
No files found.
libcaf_net/caf/net/producer_adapter.hpp
View file @
e9eb8ba4
...
@@ -78,18 +78,26 @@ public:
...
@@ -78,18 +78,26 @@ public:
/// @returns the remaining demand.
/// @returns the remaining demand.
/// @pre `demand() > 0`
/// @pre `demand() > 0`
size_t
push
(
const
value_type
&
item
)
{
size_t
push
(
const
value_type
&
item
)
{
CAF_ASSERT
(
demand_
>
0
);
if
(
buf_
)
{
buf_
->
push
(
item
);
CAF_ASSERT
(
demand_
>
0
);
return
--
demand_
;
buf_
->
push
(
item
);
return
--
demand_
;
}
else
{
return
0
;
}
}
}
/// Makes `items` available to the consumer.
/// Makes `items` available to the consumer.
/// @returns the remaining demand.
/// @returns the remaining demand.
/// @pre `demand() >= items.size()`
/// @pre `demand() >= items.size()`
size_t
push
(
span
<
const
value_type
>
items
)
{
size_t
push
(
span
<
const
value_type
>
items
)
{
CAF_ASSERT
(
demand_
>=
items
.
size
());
if
(
buf_
)
{
buf_
->
push
(
items
);
CAF_ASSERT
(
demand_
>=
items
.
size
());
return
demand_
-=
items
.
size
();
buf_
->
push
(
items
);
return
demand_
-=
items
.
size
();
}
else
{
return
0
;
}
}
}
void
close
()
{
void
close
()
{
...
...
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