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
5fc5bd29
Commit
5fc5bd29
authored
Apr 08, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue/906'
parents
921ab3c7
401c48ff
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
7 additions
and
388 deletions
+7
-388
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+0
-1
libcaf_core/caf/raw_event_based_actor.hpp
libcaf_core/caf/raw_event_based_actor.hpp
+0
-48
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+1
-213
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+0
-1
libcaf_core/src/raw_event_based_actor.cpp
libcaf_core/src/raw_event_based_actor.cpp
+0
-114
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+3
-2
libcaf_core/test/actor_clock.cpp
libcaf_core/test/actor_clock.cpp
+3
-8
libcaf_io/src/io/middleman.cpp
libcaf_io/src/io/middleman.cpp
+0
-1
No files found.
libcaf_core/CMakeLists.txt
View file @
5fc5bd29
...
...
@@ -123,7 +123,6 @@ set(CAF_CORE_SOURCES
src/policy/work_stealing.cpp
src/proxy_registry.cpp
src/raise_error.cpp
src/raw_event_based_actor.cpp
src/ref_counted.cpp
src/replies_to.cpp
src/response_promise.cpp
...
...
libcaf_core/caf/raw_event_based_actor.hpp
deleted
100644 → 0
View file @
921ab3c7
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
#include "caf/detail/core_export.hpp"
#include "caf/event_based_actor.hpp"
namespace
caf
{
/// A cooperatively raw scheduled actor is a dynamically typed actor that does
/// not handle any system messages. All handler for system messages as well as
/// the default handler are ignored. This actor type is for testing and
/// system-level actors.
/// @extends event_based_actor
class
CAF_CORE_EXPORT
raw_event_based_actor
:
public
event_based_actor
{
public:
// -- member types -----------------------------------------------------------
/// Required by `spawn` for type deduction.
using
signatures
=
none_t
;
/// Required by `spawn` for type deduction.
using
behavior_type
=
behavior
;
// -- constructors and destructors -------------------------------------------
explicit
raw_event_based_actor
(
actor_config
&
cfg
);
invoke_message_result
consume
(
mailbox_element
&
x
)
override
;
};
}
// namespace caf
libcaf_core/caf/scheduled_actor.hpp
View file @
5fc5bd29
This diff is collapsed.
Click to expand it.
libcaf_core/src/actor_system.cpp
View file @
5fc5bd29
...
...
@@ -28,7 +28,6 @@
#include "caf/policy/work_sharing.hpp"
#include "caf/policy/work_stealing.hpp"
#include "caf/raise_error.hpp"
#include "caf/raw_event_based_actor.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/scheduler/coordinator.hpp"
#include "caf/scheduler/test_coordinator.hpp"
...
...
libcaf_core/src/raw_event_based_actor.cpp
deleted
100644 → 0
View file @
921ab3c7
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/raw_event_based_actor.hpp"
#include "caf/detail/default_invoke_result_visitor.hpp"
namespace
caf
{
raw_event_based_actor
::
raw_event_based_actor
(
actor_config
&
cfg
)
:
event_based_actor
(
cfg
)
{
// nop
}
invoke_message_result
raw_event_based_actor
::
consume
(
mailbox_element
&
x
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
x
));
current_element_
=
&
x
;
CAF_LOG_RECEIVE_EVENT
(
current_element_
);
CAF_BEFORE_PROCESSING
(
this
,
x
);
// Wrap the actual body for the function.
auto
body
=
[
this
,
&
x
]
{
// short-circuit awaited responses
if
(
!
awaited_responses_
.
empty
())
{
auto
&
pr
=
awaited_responses_
.
front
();
// skip all messages until we receive the currently awaited response
if
(
x
.
mid
!=
pr
.
first
)
return
invoke_message_result
::
skipped
;
if
(
!
pr
.
second
(
x
.
content
()))
{
// try again with error if first attempt failed
auto
msg
=
make_message
(
make_error
(
sec
::
unexpected_response
,
std
::
move
(
x
.
payload
)));
pr
.
second
(
msg
);
}
awaited_responses_
.
pop_front
();
return
invoke_message_result
::
consumed
;
}
// handle multiplexed responses
if
(
x
.
mid
.
is_response
())
{
auto
mrh
=
multiplexed_responses_
.
find
(
x
.
mid
);
// neither awaited nor multiplexed, probably an expired timeout
if
(
mrh
==
multiplexed_responses_
.
end
())
return
invoke_message_result
::
dropped
;
if
(
!
mrh
->
second
(
x
.
content
()))
{
// try again with error if first attempt failed
auto
msg
=
make_message
(
make_error
(
sec
::
unexpected_response
,
std
::
move
(
x
.
payload
)));
mrh
->
second
(
msg
);
}
multiplexed_responses_
.
erase
(
mrh
);
return
invoke_message_result
::
consumed
;
}
auto
&
content
=
x
.
content
();
// handle timeout messages
if
(
content
.
match_elements
<
timeout_msg
>
())
{
auto
&
tm
=
content
.
get_as
<
timeout_msg
>
(
0
);
auto
tid
=
tm
.
timeout_id
;
CAF_ASSERT
(
x
.
mid
.
is_async
());
if
(
is_active_receive_timeout
(
tid
))
{
CAF_LOG_DEBUG
(
"handle timeout message"
);
if
(
bhvr_stack_
.
empty
())
return
invoke_message_result
::
dropped
;
bhvr_stack_
.
back
().
handle_timeout
();
return
invoke_message_result
::
consumed
;
}
CAF_LOG_DEBUG
(
"dropped expired timeout message"
);
return
invoke_message_result
::
dropped
;
}
// handle everything else as ordinary message
detail
::
default_invoke_result_visitor
<
event_based_actor
>
visitor
{
this
};
auto
had_timeout
=
getf
(
has_timeout_flag
);
if
(
had_timeout
)
unsetf
(
has_timeout_flag
);
if
(
!
bhvr_stack_
.
empty
())
{
auto
&
bhvr
=
bhvr_stack_
.
back
();
if
(
bhvr
(
visitor
,
x
.
content
()))
return
invoke_message_result
::
consumed
;
}
auto
sres
=
call_handler
(
default_handler_
,
this
,
x
.
payload
);
auto
f
=
detail
::
make_overload
(
[
&
](
auto
&
x
)
{
visitor
(
x
);
return
invoke_message_result
::
consumed
;
},
[
&
](
skip_t
&
x
)
{
// Restore timeout if message was skipped.
if
(
had_timeout
)
setf
(
has_timeout_flag
);
return
invoke_message_result
::
skipped
;
});
return
visit
(
f
,
sres
);
};
// Post-process the returned value from the function body.
auto
result
=
body
();
CAF_AFTER_PROCESSING
(
this
,
result
);
CAF_LOG_SKIP_OR_FINALIZE_EVENT
(
result
);
return
result
;
}
}
// namespace caf
libcaf_core/src/scheduled_actor.cpp
View file @
5fc5bd29
...
...
@@ -580,10 +580,11 @@ scheduled_actor::categorize(mailbox_element& x) {
CAF_LOG_DEBUG
(
"handle ordinary timeout message"
);
if
(
is_active_receive_timeout
(
tid
)
&&
!
bhvr_stack_
.
empty
())
bhvr_stack_
.
back
().
handle_timeout
();
}
else
{
CAF_ASSERT
(
tm
.
type
==
"stream"
);
}
else
if
(
tm
.
type
==
"stream"
)
{
CAF_LOG_DEBUG
(
"handle stream timeout message"
);
set_stream_timeout
(
advance_streams
(
clock
().
now
()));
}
else
{
// Drop. Other types not supported yet.
}
return
message_category
::
internal
;
}
...
...
libcaf_core/test/actor_clock.cpp
View file @
5fc5bd29
...
...
@@ -27,7 +27,6 @@
#include "caf/all.hpp"
#include "caf/detail/test_actor_clock.hpp"
#include "caf/raw_event_based_actor.hpp"
using
namespace
caf
;
...
...
@@ -39,8 +38,10 @@ struct testee_state {
uint64_t
timeout_id
=
41
;
};
behavior
testee
(
stateful_actor
<
testee_state
,
raw_event_based_actor
>*
self
,
behavior
testee
(
stateful_actor
<
testee_state
>*
self
,
detail
::
test_actor_clock
*
t
)
{
self
->
set_exit_handler
([
self
](
exit_msg
&
x
)
{
self
->
quit
(
x
.
reason
);
});
self
->
set_error_handler
([](
scheduled_actor
*
,
error
&
)
{});
return
{
[
=
](
ok_atom
)
{
CAF_LOG_TRACE
(
""
<<
self
->
current_mailbox_element
()
->
content
());
...
...
@@ -61,17 +62,11 @@ behavior testee(stateful_actor<testee_state, raw_event_based_actor>* self,
auto
mid
=
make_message_id
(
self
->
state
.
timeout_id
).
response_id
();
t
->
set_request_timeout
(
n
,
self
,
mid
);
},
[](
const
timeout_msg
&
)
{
CAF_LOG_TRACE
(
""
);
},
[](
const
error
&
)
{
CAF_LOG_TRACE
(
""
);
},
[](
const
std
::
string
&
)
{
CAF_LOG_TRACE
(
""
);
},
[
=
](
group
&
grp
)
{
CAF_LOG_TRACE
(
""
);
self
->
join
(
grp
);
},
[
=
](
exit_msg
&
x
)
{
CAF_LOG_TRACE
(
""
);
self
->
quit
(
x
.
reason
);
},
};
}
...
...
libcaf_io/src/io/middleman.cpp
View file @
5fc5bd29
...
...
@@ -49,7 +49,6 @@
#include "caf/logger.hpp"
#include "caf/make_counted.hpp"
#include "caf/node_id.hpp"
#include "caf/raw_event_based_actor.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/scoped_actor.hpp"
#include "caf/sec.hpp"
...
...
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