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
ee447203
Commit
ee447203
authored
Aug 25, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue in http_broker test during shutdown
parent
4a97de85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
11 deletions
+28
-11
libcaf_io/caf/io/network/test_multiplexer.hpp
libcaf_io/caf/io/network/test_multiplexer.hpp
+3
-0
libcaf_io/src/test_multiplexer.cpp
libcaf_io/src/test_multiplexer.cpp
+15
-3
libcaf_io/test/http_broker.cpp
libcaf_io/test/http_broker.cpp
+10
-8
No files found.
libcaf_io/caf/io/network/test_multiplexer.hpp
View file @
ee447203
...
...
@@ -122,6 +122,9 @@ public:
/// Returns `true` if a `runnable` was available, `false` otherwise.
bool
try_exec_runnable
();
/// Executes all pending `runnable` objects.
void
flush_runnables
();
protected:
void
dispatch_runnable
(
runnable_ptr
ptr
)
override
;
...
...
libcaf_io/src/test_multiplexer.cpp
View file @
ee447203
...
...
@@ -268,11 +268,11 @@ void test_multiplexer::read_data(connection_handle hdl) {
break
;
case
receive_policy_flag
:
:
at_most
:
auto
max_bytes
=
static_cast
<
ptrdiff_t
>
(
sd
.
recv_conf
.
second
);
while
(
sd
.
xbuf
.
size
()
>
0
)
{
while
(
!
sd
.
xbuf
.
empty
()
)
{
sd
.
rd_buf
.
clear
();
auto
xbuf_size
=
static_cast
<
ptrdiff_t
>
(
sd
.
xbuf
.
size
());
auto
first
=
sd
.
xbuf
.
begin
();
auto
last
=
(
max_bytes
<
sd
.
xbuf
.
size
())
?
first
+
max_bytes
:
sd
.
xbuf
.
end
();
auto
last
=
(
max_bytes
<
xbuf_size
)
?
first
+
max_bytes
:
sd
.
xbuf
.
end
();
sd
.
rd_buf
.
insert
(
sd
.
rd_buf
.
end
(),
first
,
last
);
sd
.
xbuf
.
erase
(
first
,
last
);
sd
.
ptr
->
consume
(
sd
.
rd_buf
.
data
(),
sd
.
rd_buf
.
size
());
...
...
@@ -312,6 +312,18 @@ bool test_multiplexer::try_exec_runnable() {
return
true
;
}
void
test_multiplexer
::
flush_runnables
()
{
std
::
vector
<
runnable_ptr
>
runnables
;
runnables
.
reserve
(
256
);
{
// critical section
guard_type
guard
{
mx_
};
while
(
!
runnables_
.
empty
())
runnables
.
emplace_back
(
std
::
move
(
runnables_
.
front
()));
}
for
(
auto
&
ptr
:
runnables
)
ptr
->
run
();
}
void
test_multiplexer
::
dispatch_runnable
(
runnable_ptr
ptr
)
{
std
::
list
<
runnable_ptr
>
tmp
;
tmp
.
emplace_back
(
std
::
move
(
ptr
));
...
...
libcaf_io/test/http_broker.cpp
View file @
ee447203
...
...
@@ -200,9 +200,10 @@ public:
~
fixture
()
{
anon_send_exit
(
aut_
,
exit_reason
::
kill
);
// run the exit message explicitly, since we do not invoke any "IO"
// from this point on that would trigger the exit message implicitly
mpx_
->
exec_runnable
();
// run the exit message and other pending messages explicitly,
// since we do not invoke any "IO" from this point on that would
// trigger the exit message implicitly
mpx_
->
flush_runnables
();
await_all_actors_done
();
shutdown
();
}
...
...
@@ -216,12 +217,13 @@ public:
mock_t
(
const
mock_t
&
)
=
default
;
mock_t
&
expect
(
const
std
::
string
&
what
)
{
mock_t
&
expect
(
const
std
::
string
&
x
)
{
auto
&
buf
=
this_
->
mpx_
->
output_buffer
(
this_
->
connection_
);
CAF_REQUIRE
((
buf
.
size
()
>=
what
.
size
()));
CAF_REQUIRE
((
std
::
equal
(
buf
.
begin
(),
buf
.
begin
()
+
what
.
size
(),
what
.
begin
()));
buf
.
erase
(
buf
.
begin
(),
buf
.
begin
()
+
what
.
size
()));
CAF_REQUIRE
((
buf
.
size
()
>=
x
.
size
()));
CAF_REQUIRE
((
std
::
equal
(
buf
.
begin
(),
buf
.
begin
()
+
static_cast
<
ptrdiff_t
>
(
x
.
size
()),
x
.
begin
()));
buf
.
erase
(
buf
.
begin
(),
buf
.
begin
()
+
static_cast
<
ptrdiff_t
>
(
x
.
size
())));
return
*
this
;
}
...
...
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