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
2c5604c6
Commit
2c5604c6
authored
Apr 26, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename {unexpected => default}_handler
Relates #444.
parent
b86b6c30
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
155 additions
and
118 deletions
+155
-118
examples/remote_actors/distributed_calculator.cpp
examples/remote_actors/distributed_calculator.cpp
+1
-1
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-0
libcaf_core/caf/all.hpp
libcaf_core/caf/all.hpp
+1
-1
libcaf_core/caf/detail/behavior_impl.hpp
libcaf_core/caf/detail/behavior_impl.hpp
+3
-3
libcaf_core/caf/detail/ctm.hpp
libcaf_core/caf/detail/ctm.hpp
+1
-1
libcaf_core/caf/detail/invoke_result_visitor.hpp
libcaf_core/caf/detail/invoke_result_visitor.hpp
+4
-4
libcaf_core/caf/detail/optional_message_visitor.hpp
libcaf_core/caf/detail/optional_message_visitor.hpp
+5
-5
libcaf_core/caf/detail/split_join.hpp
libcaf_core/caf/detail/split_join.hpp
+2
-2
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+1
-0
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+11
-19
libcaf_core/caf/match_case.hpp
libcaf_core/caf/match_case.hpp
+1
-1
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+1
-1
libcaf_core/caf/result.hpp
libcaf_core/caf/result.hpp
+5
-5
libcaf_core/caf/skip.hpp
libcaf_core/caf/skip.hpp
+27
-15
libcaf_core/caf/typed_behavior.hpp
libcaf_core/caf/typed_behavior.hpp
+5
-5
libcaf_core/src/blocking_actor.cpp
libcaf_core/src/blocking_actor.cpp
+1
-1
libcaf_core/src/group_manager.cpp
libcaf_core/src/group_manager.cpp
+2
-2
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+9
-13
libcaf_core/src/message.cpp
libcaf_core/src/message.cpp
+12
-12
libcaf_core/src/skip.cpp
libcaf_core/src/skip.cpp
+35
-0
libcaf_core/src/splitter.cpp
libcaf_core/src/splitter.cpp
+2
-2
libcaf_core/test/dynamic_spawn.cpp
libcaf_core/test/dynamic_spawn.cpp
+2
-2
libcaf_core/test/message_lifetime.cpp
libcaf_core/test/message_lifetime.cpp
+1
-1
libcaf_core/test/metaprogramming.cpp
libcaf_core/test/metaprogramming.cpp
+1
-1
libcaf_core/test/request.cpp
libcaf_core/test/request.cpp
+6
-6
libcaf_core/test/serial_reply.cpp
libcaf_core/test/serial_reply.cpp
+1
-1
libcaf_core/test/splitter.cpp
libcaf_core/test/splitter.cpp
+2
-2
libcaf_core/test/typed_spawn.cpp
libcaf_core/test/typed_spawn.cpp
+6
-6
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+2
-2
libcaf_io/test/basp.cpp
libcaf_io/test/basp.cpp
+1
-1
libcaf_io/test/remote_group.cpp
libcaf_io/test/remote_group.cpp
+2
-2
libcaf_io/test/remote_spawn.cpp
libcaf_io/test/remote_spawn.cpp
+1
-1
No files found.
examples/remote_actors/distributed_calculator.cpp
View file @
2c5604c6
...
@@ -153,7 +153,7 @@ private:
...
@@ -153,7 +153,7 @@ private:
);
);
},
},
// simply ignore all requests until we have a connection
// simply ignore all requests until we have a connection
others >> skip
_message
others >> skip
};
};
*/
*/
}
}
...
...
libcaf_core/CMakeLists.txt
View file @
2c5604c6
...
@@ -81,6 +81,7 @@ set (LIBCAF_CORE_SRCS
...
@@ -81,6 +81,7 @@ set (LIBCAF_CORE_SRCS
src/serializer.cpp
src/serializer.cpp
src/sequencer.cpp
src/sequencer.cpp
src/shared_spinlock.cpp
src/shared_spinlock.cpp
src/skip.cpp
src/splitter.cpp
src/splitter.cpp
src/sync_request_bouncer.cpp
src/sync_request_bouncer.cpp
src/try_match.cpp
src/try_match.cpp
...
...
libcaf_core/caf/all.hpp
View file @
2c5604c6
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
#include "caf/actor_system.hpp"
#include "caf/actor_system.hpp"
#include "caf/deserializer.hpp"
#include "caf/deserializer.hpp"
#include "caf/scoped_actor.hpp"
#include "caf/scoped_actor.hpp"
#include "caf/skip
_message
.hpp"
#include "caf/skip.hpp"
#include "caf/actor_ostream.hpp"
#include "caf/actor_ostream.hpp"
#include "caf/function_view.hpp"
#include "caf/function_view.hpp"
#include "caf/index_mapping.hpp"
#include "caf/index_mapping.hpp"
...
...
libcaf_core/caf/detail/behavior_impl.hpp
View file @
2c5604c6
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include "caf/message.hpp"
#include "caf/message.hpp"
#include "caf/duration.hpp"
#include "caf/duration.hpp"
#include "caf/ref_counted.hpp"
#include "caf/ref_counted.hpp"
#include "caf/skip
_message
.hpp"
#include "caf/skip.hpp"
#include "caf/response_promise.hpp"
#include "caf/response_promise.hpp"
#include "caf/timeout_definition.hpp"
#include "caf/timeout_definition.hpp"
#include "caf/typed_response_promise.hpp"
#include "caf/typed_response_promise.hpp"
...
@@ -55,9 +55,9 @@ namespace caf {
...
@@ -55,9 +55,9 @@ namespace caf {
namespace
detail
{
namespace
detail
{
template
<
class
...
Ts
>
template
<
class
...
Ts
>
struct
has_skip
_message
{
struct
has_skip
{
static
constexpr
bool
value
=
static
constexpr
bool
value
=
disjunction
<
std
::
is_same
<
Ts
,
skip_
message_
t
>::
value
...
>::
value
;
disjunction
<
std
::
is_same
<
Ts
,
skip_t
>::
value
...
>::
value
;
};
};
class
behavior_impl
:
public
ref_counted
{
class
behavior_impl
:
public
ref_counted
{
...
...
libcaf_core/caf/detail/ctm.hpp
View file @
2c5604c6
...
@@ -72,7 +72,7 @@ struct ctm_cmp<typed_mpi<In, type_list<Ts...>>,
...
@@ -72,7 +72,7 @@ struct ctm_cmp<typed_mpi<In, type_list<Ts...>>,
template
<
class
In
,
class
Out
>
template
<
class
In
,
class
Out
>
struct
ctm_cmp
<
typed_mpi
<
In
,
Out
>
,
struct
ctm_cmp
<
typed_mpi
<
In
,
Out
>
,
typed_mpi
<
In
,
type_list
<
skip_
message_
t
>>>
typed_mpi
<
In
,
type_list
<
skip_t
>>>
:
std
::
true_type
{
};
:
std
::
true_type
{
};
template
<
class
In
,
class
...
Ts
>
template
<
class
In
,
class
...
Ts
>
...
...
libcaf_core/caf/detail/invoke_result_visitor.hpp
View file @
2c5604c6
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include "caf/optional.hpp"
#include "caf/optional.hpp"
#include "caf/result.hpp"
#include "caf/result.hpp"
#include "caf/message.hpp"
#include "caf/message.hpp"
#include "caf/skip
_message
.hpp"
#include "caf/skip.hpp"
#include "caf/typed_continue_helper.hpp"
#include "caf/typed_continue_helper.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/int_list.hpp"
...
@@ -120,15 +120,15 @@ public:
...
@@ -120,15 +120,15 @@ public:
return
true
;
return
true
;
}
}
inline
bool
visit
(
skip_
message_
t
&
)
{
inline
bool
visit
(
skip_t
&
)
{
return
false
;
return
false
;
}
}
inline
bool
visit
(
const
skip_
message_
t
&
)
{
inline
bool
visit
(
const
skip_t
&
)
{
return
false
;
return
false
;
}
}
inline
bool
visit
(
optional
<
skip_
message_
t
>&
x
)
{
inline
bool
visit
(
optional
<
skip_t
>&
x
)
{
if
(
x
)
if
(
x
)
return
false
;
return
false
;
(
*
this
)(
x
);
(
*
this
)(
x
);
...
...
libcaf_core/caf/detail/optional_message_visitor.hpp
View file @
2c5604c6
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#include "caf/unit.hpp"
#include "caf/unit.hpp"
#include "caf/optional.hpp"
#include "caf/optional.hpp"
#include "caf/delegated.hpp"
#include "caf/delegated.hpp"
#include "caf/skip
_message
.hpp"
#include "caf/skip.hpp"
#include "caf/static_visitor.hpp"
#include "caf/static_visitor.hpp"
#include "caf/response_promise.hpp"
#include "caf/response_promise.hpp"
#include "caf/typed_response_promise.hpp"
#include "caf/typed_response_promise.hpp"
...
@@ -63,8 +63,8 @@ struct optional_message_visitor_enable_tpl {
...
@@ -63,8 +63,8 @@ struct optional_message_visitor_enable_tpl {
typename
std
::
remove_const
<
T
>::
type
,
typename
std
::
remove_const
<
T
>::
type
,
none_t
,
none_t
,
unit_t
,
unit_t
,
skip_
message_
t
,
skip_t
,
optional
<
skip_
message_
t
>
optional
<
skip_t
>
>::
value
>::
value
&&
!
is_message_id_wrapper
<
T
>::
value
&&
!
is_message_id_wrapper
<
T
>::
value
&&
!
is_response_promise
<
T
>::
value
;
&&
!
is_response_promise
<
T
>::
value
;
...
@@ -80,7 +80,7 @@ public:
...
@@ -80,7 +80,7 @@ public:
return
none
;
return
none
;
}
}
inline
opt_msg
operator
()(
const
skip_
message_
t
&
)
const
{
inline
opt_msg
operator
()(
const
skip_t
&
)
const
{
return
none
;
return
none
;
}
}
...
@@ -88,7 +88,7 @@ public:
...
@@ -88,7 +88,7 @@ public:
return
message
{};
return
message
{};
}
}
inline
opt_msg
operator
()(
optional
<
skip_
message_
t
>&
val
)
const
{
inline
opt_msg
operator
()(
optional
<
skip_t
>&
val
)
const
{
if
(
val
)
if
(
val
)
return
none
;
return
none
;
return
message
{};
return
message
{};
...
...
libcaf_core/caf/detail/split_join.hpp
View file @
2c5604c6
...
@@ -65,10 +65,10 @@ public:
...
@@ -65,10 +65,10 @@ public:
}
}
return
delegated
<
message
>
{};
return
delegated
<
message
>
{};
};
};
set_
unexpected
_handler
(
g
);
set_
default
_handler
(
g
);
return
delegated
<
message
>
{};
return
delegated
<
message
>
{};
};
};
set_
unexpected
_handler
(
f
);
set_
default
_handler
(
f
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
libcaf_core/caf/fwd.hpp
View file @
2c5604c6
...
@@ -39,6 +39,7 @@ template <class, class, int> class actor_cast_access;
...
@@ -39,6 +39,7 @@ template <class, class, int> class actor_cast_access;
// -- variadic templates -------------------------------------------------------
// -- variadic templates -------------------------------------------------------
template
<
class
...
>
class
result
;
template
<
class
...
>
class
delegated
;
template
<
class
...
>
class
delegated
;
template
<
class
...
>
class
typed_actor
;
template
<
class
...
>
class
typed_actor
;
template
<
class
...
>
class
typed_response_promise
;
template
<
class
...
>
class
typed_response_promise
;
...
...
libcaf_core/caf/local_actor.hpp
View file @
2c5604c6
...
@@ -85,32 +85,24 @@ struct make_response_promise_helper<response_promise> {
...
@@ -85,32 +85,24 @@ struct make_response_promise_helper<response_promise> {
}
// namespace detail
}
// namespace detail
/// @relates local_actor
/// @relates local_actor
/// Default handler function for unexpected messages
/// Default handler function that sends the message back to the sender.
/// that sends the message back to the sender.
result
<
message
>
reflect
(
local_actor
*
,
const
type_erased_tuple
*
);
result
<
message
>
reflect_unexpected
(
local_actor
*
,
const
type_erased_tuple
*
);
/// @relates local_actor
/// @relates local_actor
/// Default handler function
for unexpected message
s
/// Default handler function
that send
s
/// th
at sends th
e message back to the sender and then quits.
/// the message back to the sender and then quits.
result
<
message
>
reflect_
unexpected_
and_quit
(
local_actor
*
,
result
<
message
>
reflect_and_quit
(
local_actor
*
,
const
type_erased_tuple
*
);
const
type_erased_tuple
*
);
/// @relates local_actor
/// @relates local_actor
/// Default handler function for unexpected messages that
/// Default handler function that prints messages
/// skips an unexpected message in order to handle it again
/// message via `aout` and drops them afterwards.
/// after a behavior change.
result
<
message
>
print_and_drop
(
local_actor
*
,
result
<
message
>
skip_unexpected
(
local_actor
*
,
const
type_erased_tuple
*
);
/// @relates local_actor
/// Default handler function for unexpected messages that prints
/// an unexpected message via `aout` and drops it afterwards.
result
<
message
>
print_and_drop_unexpected
(
local_actor
*
,
const
type_erased_tuple
*
);
const
type_erased_tuple
*
);
/// @relates local_actor
/// @relates local_actor
/// Default handler function for unexpected messages that
/// Default handler function that simply drops messages.
/// drops unexpected messages without printing them.
result
<
message
>
drop
(
local_actor
*
,
const
type_erased_tuple
*
);
result
<
message
>
drop_unexpected
(
local_actor
*
,
const
type_erased_tuple
*
);
/// Base class for actors running on this node, either
/// Base class for actors running on this node, either
/// living in an own thread or cooperatively scheduled.
/// living in an own thread or cooperatively scheduled.
...
@@ -318,7 +310,7 @@ public:
...
@@ -318,7 +310,7 @@ public:
// -- miscellaneous actor operations -----------------------------------------
// -- miscellaneous actor operations -----------------------------------------
/// Sets a custom handler for unexpected messages.
/// Sets a custom handler for unexpected messages.
inline
void
set_
unexpected
_handler
(
unexpected_handler
fun
)
{
inline
void
set_
default
_handler
(
unexpected_handler
fun
)
{
unexpected_handler_
=
std
::
move
(
fun
);
unexpected_handler_
=
std
::
move
(
fun
);
}
}
...
...
libcaf_core/caf/match_case.hpp
View file @
2c5604c6
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include "caf/param.hpp"
#include "caf/param.hpp"
#include "caf/optional.hpp"
#include "caf/optional.hpp"
#include "caf/match_case.hpp"
#include "caf/match_case.hpp"
#include "caf/skip
_message
.hpp"
#include "caf/skip.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/try_match.hpp"
#include "caf/detail/try_match.hpp"
...
...
libcaf_core/caf/message.hpp
View file @
2c5604c6
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include "caf/config.hpp"
#include "caf/config.hpp"
#include "caf/optional.hpp"
#include "caf/optional.hpp"
#include "caf/make_counted.hpp"
#include "caf/make_counted.hpp"
#include "caf/skip
_message
.hpp"
#include "caf/skip.hpp"
#include "caf/index_mapping.hpp"
#include "caf/index_mapping.hpp"
#include "caf/allowed_unsafe_message_type.hpp"
#include "caf/allowed_unsafe_message_type.hpp"
...
...
libcaf_core/caf/result.hpp
View file @
2c5604c6
...
@@ -21,10 +21,10 @@
...
@@ -21,10 +21,10 @@
#define CAF_RESULT_HPP
#define CAF_RESULT_HPP
#include "caf/none.hpp"
#include "caf/none.hpp"
#include "caf/skip.hpp"
#include "caf/error.hpp"
#include "caf/error.hpp"
#include "caf/message.hpp"
#include "caf/message.hpp"
#include "caf/delegated.hpp"
#include "caf/delegated.hpp"
#include "caf/skip_message.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -32,11 +32,11 @@ enum result_runtime_type {
...
@@ -32,11 +32,11 @@ enum result_runtime_type {
rt_value
,
rt_value
,
rt_error
,
rt_error
,
rt_delegated
,
rt_delegated
,
rt_skip
_message
rt_skip
};
};
template
<
class
...
Ts
>
template
<
class
...
Ts
>
struct
result
{
class
result
{
public:
public:
result
(
Ts
...
xs
)
:
flag
(
rt_value
),
value
(
make_message
(
std
::
move
(
xs
)...))
{
result
(
Ts
...
xs
)
:
flag
(
rt_value
),
value
(
make_message
(
std
::
move
(
xs
)...))
{
// nop
// nop
...
@@ -62,7 +62,7 @@ public:
...
@@ -62,7 +62,7 @@ public:
// nop
// nop
}
}
result
(
skip_
message_t
)
:
flag
(
rt_skip_message
)
{
result
(
skip_
t
)
:
flag
(
rt_skip
)
{
// nop
// nop
}
}
...
@@ -106,7 +106,7 @@ public:
...
@@ -106,7 +106,7 @@ public:
// nop
// nop
}
}
result
(
skip_
message_t
)
:
flag
(
rt_skip_message
)
{
result
(
skip_
t
)
:
flag
(
rt_skip
)
{
// nop
// nop
}
}
...
...
libcaf_core/caf/skip
_message
.hpp
→
libcaf_core/caf/skip.hpp
View file @
2c5604c6
...
@@ -17,31 +17,43 @@
...
@@ -17,31 +17,43 @@
* http://www.boost.org/LICENSE_1_0.txt. *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
******************************************************************************/
#ifndef CAF_SKIP_
MESSAGE_
HPP
#ifndef CAF_SKIP_HPP
#define CAF_SKIP_
MESSAGE_
HPP
#define CAF_SKIP_HPP
#include <ostream>
#include <functional>
#include "caf/fwd.hpp"
namespace
caf
{
namespace
caf
{
/// Optional return type for functors used in pattern matching
/// @relates local_actor
/// expressions. This type is evaluated by the runtime system
/// Default handler function that leaves messages in the mailbox.
/// and can be used to intentionally skip messages.
/// Can also be used inside custom message handlers to signalize
struct
skip_message_t
{
/// skipping to the runtime.
constexpr
skip_message_t
()
{}
class
skip_t
{
public:
using
fun
=
std
::
function
<
result
<
message
>
(
local_actor
*
self
,
const
type_erased_tuple
*
)
>
;
constexpr
skip_t
()
{
// nop
}
constexpr
skip_t
operator
()()
const
{
return
*
this
;
}
operator
fun
()
const
;
private:
static
result
<
message
>
skip_fun_impl
(
local_actor
*
,
const
type_erased_tuple
*
);
};
};
/// Tells the runtime system to skip a message when used as message
/// Tells the runtime system to skip a message when used as message
/// handler, i.e., causes the runtime to leave the message in
/// handler, i.e., causes the runtime to leave the message in
/// the mailbox of an actor.
/// the mailbox of an actor.
constexpr
skip_message_t
skip_message
()
{
constexpr
skip_t
skip
=
skip_t
{};
return
{};
}
// implemented in string_serialization.cpp
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
skip_message_t
);
}
// namespace caf
}
// namespace caf
#endif // CAF_SKIP_
MESSAGE_
HPP
#endif // CAF_SKIP_HPP
libcaf_core/caf/typed_behavior.hpp
View file @
2c5604c6
...
@@ -41,17 +41,17 @@ struct input_only<detail::type_list<Ts...>> {
...
@@ -41,17 +41,17 @@ struct input_only<detail::type_list<Ts...>> {
using
type
=
detail
::
type_list
<
typename
Ts
::
input_types
...
>
;
using
type
=
detail
::
type_list
<
typename
Ts
::
input_types
...
>
;
};
};
using
skip_list
=
detail
::
type_list
<
skip_
message_
t
>
;
using
skip_list
=
detail
::
type_list
<
skip_t
>
;
template
<
class
Input
,
class
RepliesToWith
>
template
<
class
Input
,
class
RepliesToWith
>
struct
same_input
:
std
::
is_same
<
Input
,
typename
RepliesToWith
::
input_types
>
{};
struct
same_input
:
std
::
is_same
<
Input
,
typename
RepliesToWith
::
input_types
>
{};
template
<
class
Output
,
class
RepliesToWith
>
template
<
class
Output
,
class
RepliesToWith
>
struct
same_output_or_skip_
message_
t
{
struct
same_output_or_skip_t
{
using
other
=
typename
RepliesToWith
::
output_types
;
using
other
=
typename
RepliesToWith
::
output_types
;
static
constexpr
bool
value
=
static
constexpr
bool
value
=
std
::
is_same
<
Output
,
typename
RepliesToWith
::
output_types
>::
value
||
std
::
is_same
<
Output
,
typename
RepliesToWith
::
output_types
>::
value
||
std
::
is_same
<
Output
,
type_list
<
skip_
message_
t
>>::
value
;
std
::
is_same
<
Output
,
type_list
<
skip_t
>>::
value
;
};
};
template
<
class
SList
>
template
<
class
SList
>
...
@@ -72,7 +72,7 @@ struct valid_input_predicate {
...
@@ -72,7 +72,7 @@ struct valid_input_predicate {
"contains at least one pattern that is "
"contains at least one pattern that is "
"not defined in the actor's type"
);
"not defined in the actor's type"
);
static
constexpr
bool
value
=
tl_exists
<
static
constexpr
bool
value
=
tl_exists
<
filtered_slist
,
tbind
<
same_output_or_skip_
message_
t
,
filtered_slist
,
tbind
<
same_output_or_skip_t
,
output_types
>::
template
type
>
::
value
;
output_types
>::
template
type
>
::
value
;
// check whether given output matches in the filtered list
// check whether given output matches in the filtered list
static_assert
(
value
,
static_assert
(
value
,
...
@@ -110,7 +110,7 @@ struct valid_input {
...
@@ -110,7 +110,7 @@ struct valid_input {
// check for each element in IList that there's an element in SList that
// check for each element in IList that there's an element in SList that
// (1) has an identical input type list
// (1) has an identical input type list
// (2) has an identical output type list
// (2) has an identical output type list
// OR the output of the element in IList is skip_
message_
t
// OR the output of the element in IList is skip_t
static_assert
(
detail
::
tl_is_distinct
<
IList
>::
value
,
static_assert
(
detail
::
tl_is_distinct
<
IList
>::
value
,
"given pattern is not distinct"
);
"given pattern is not distinct"
);
static
constexpr
bool
value
=
static
constexpr
bool
value
=
...
...
libcaf_core/src/blocking_actor.cpp
View file @
2c5604c6
...
@@ -28,7 +28,7 @@ namespace caf {
...
@@ -28,7 +28,7 @@ namespace caf {
blocking_actor
::
blocking_actor
(
actor_config
&
sys
)
:
super
(
sys
)
{
blocking_actor
::
blocking_actor
(
actor_config
&
sys
)
:
super
(
sys
)
{
is_blocking
(
true
);
is_blocking
(
true
);
set_
unexpected_handler
(
skip_unexpected
);
set_
default_handler
(
skip
);
}
}
blocking_actor
::~
blocking_actor
()
{
blocking_actor
::~
blocking_actor
()
{
...
...
libcaf_core/src/group_manager.cpp
View file @
2c5604c6
...
@@ -169,7 +169,7 @@ public:
...
@@ -169,7 +169,7 @@ public:
send_to_acquaintances
(
message
::
from
(
ptr
));
send_to_acquaintances
(
message
::
from
(
ptr
));
return
message
{};
return
message
{};
};
};
set_
unexpected
_handler
(
fwd
);
set_
default
_handler
(
fwd
);
// return behavior
// return behavior
return
{
return
{
[
=
](
join_atom
,
const
actor
&
other
)
{
[
=
](
join_atom
,
const
actor
&
other
)
{
...
@@ -329,7 +329,7 @@ behavior proxy_broker::make_behavior() {
...
@@ -329,7 +329,7 @@ behavior proxy_broker::make_behavior() {
context
());
context
());
return
message
{};
return
message
{};
};
};
set_
unexpected
_handler
(
fwd
);
set_
default
_handler
(
fwd
);
// return dummy behavior
// return dummy behavior
return
{
return
{
[](
const
down_msg
&
)
{
[](
const
down_msg
&
)
{
...
...
libcaf_core/src/local_actor.cpp
View file @
2c5604c6
...
@@ -39,21 +39,17 @@
...
@@ -39,21 +39,17 @@
namespace
caf
{
namespace
caf
{
result
<
message
>
reflect
_unexpected
(
local_actor
*
,
const
type_erased_tuple
*
x
)
{
result
<
message
>
reflect
(
local_actor
*
,
const
type_erased_tuple
*
x
)
{
return
message
::
from
(
x
);
return
message
::
from
(
x
);
}
}
result
<
message
>
reflect_
unexpected_
and_quit
(
local_actor
*
self
,
result
<
message
>
reflect_and_quit
(
local_actor
*
self
,
const
type_erased_tuple
*
x
)
{
const
type_erased_tuple
*
x
)
{
self
->
quit
();
self
->
quit
();
return
reflect
_unexpected
(
self
,
x
);
return
reflect
(
self
,
x
);
}
}
result
<
message
>
skip_unexpected
(
local_actor
*
,
const
type_erased_tuple
*
)
{
result
<
message
>
print_and_drop
(
local_actor
*
self
,
return
skip_message
();
}
result
<
message
>
print_and_drop_unexpected
(
local_actor
*
self
,
const
type_erased_tuple
*
x
)
{
const
type_erased_tuple
*
x
)
{
CAF_LOG_WARNING
(
"unexpected message"
<<
CAF_ARG
(
*
x
));
CAF_LOG_WARNING
(
"unexpected message"
<<
CAF_ARG
(
*
x
));
aout
(
self
)
<<
"*** unexpected message [id: "
<<
self
->
id
()
aout
(
self
)
<<
"*** unexpected message [id: "
<<
self
->
id
()
...
@@ -62,7 +58,7 @@ result<message> print_and_drop_unexpected(local_actor* self,
...
@@ -62,7 +58,7 @@ result<message> print_and_drop_unexpected(local_actor* self,
return
sec
::
unexpected_message
;
return
sec
::
unexpected_message
;
}
}
result
<
message
>
drop
_unexpected
(
local_actor
*
,
result
<
message
>
drop
(
local_actor
*
,
const
type_erased_tuple
*
)
{
const
type_erased_tuple
*
)
{
return
sec
::
unexpected_message
;
return
sec
::
unexpected_message
;
}
}
...
@@ -76,7 +72,7 @@ local_actor::local_actor(actor_config& cfg)
...
@@ -76,7 +72,7 @@ local_actor::local_actor(actor_config& cfg)
planned_exit_reason_
(
exit_reason
::
not_exited
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
timeout_id_
(
0
),
timeout_id_
(
0
),
initial_behavior_fac_
(
std
::
move
(
cfg
.
init_fun
)),
initial_behavior_fac_
(
std
::
move
(
cfg
.
init_fun
)),
unexpected_handler_
(
print_and_drop
_unexpected
)
{
unexpected_handler_
(
print_and_drop
)
{
if
(
cfg
.
groups
!=
nullptr
)
if
(
cfg
.
groups
!=
nullptr
)
for
(
auto
&
grp
:
*
cfg
.
groups
)
for
(
auto
&
grp
:
*
cfg
.
groups
)
join
(
grp
);
join
(
grp
);
...
@@ -86,7 +82,7 @@ local_actor::local_actor()
...
@@ -86,7 +82,7 @@ local_actor::local_actor()
:
monitorable_actor
(
abstract_channel
::
is_abstract_actor_flag
),
:
monitorable_actor
(
abstract_channel
::
is_abstract_actor_flag
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
timeout_id_
(
0
),
timeout_id_
(
0
),
unexpected_handler_
(
print_and_drop
_unexpected
)
{
unexpected_handler_
(
print_and_drop
)
{
// nop
// nop
}
}
...
@@ -94,7 +90,7 @@ local_actor::local_actor(int init_flags)
...
@@ -94,7 +90,7 @@ local_actor::local_actor(int init_flags)
:
monitorable_actor
(
init_flags
),
:
monitorable_actor
(
init_flags
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
timeout_id_
(
0
),
timeout_id_
(
0
),
unexpected_handler_
(
print_and_drop
_unexpected
)
{
unexpected_handler_
(
print_and_drop
)
{
// nop
// nop
}
}
...
@@ -532,7 +528,7 @@ invoke_message_result local_actor::invoke_message(mailbox_element_ptr& ptr,
...
@@ -532,7 +528,7 @@ invoke_message_result local_actor::invoke_message(mailbox_element_ptr& ptr,
has_timeout
(
true
);
has_timeout
(
true
);
auto
sres
=
unexpected_handler_
(
this
,
auto
sres
=
unexpected_handler_
(
this
,
current_element_
->
msg
.
cvals
().
get
());
current_element_
->
msg
.
cvals
().
get
());
if
(
sres
.
flag
!=
rt_skip
_message
)
if
(
sres
.
flag
!=
rt_skip
)
visitor
.
visit
(
sres
);
visitor
.
visit
(
sres
);
else
else
skipped
=
true
;
skipped
=
true
;
...
...
libcaf_core/src/message.cpp
View file @
2c5604c6
...
@@ -244,9 +244,9 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
...
@@ -244,9 +244,9 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
// store any occurred error in a temporary variable returned at the end
// store any occurred error in a temporary variable returned at the end
std
::
string
error
;
std
::
string
error
;
auto
res
=
extract
({
auto
res
=
extract
({
[
&
](
const
std
::
string
&
arg
)
->
optional
<
skip_
message_
t
>
{
[
&
](
const
std
::
string
&
arg
)
->
optional
<
skip_t
>
{
if
(
arg
.
empty
()
||
arg
.
front
()
!=
'-'
)
{
if
(
arg
.
empty
()
||
arg
.
front
()
!=
'-'
)
{
return
skip
_message
();
return
skip
();
}
}
auto
i
=
shorts
.
find
(
arg
.
substr
(
0
,
2
));
auto
i
=
shorts
.
find
(
arg
.
substr
(
0
,
2
));
if
(
i
!=
shorts
.
end
())
{
if
(
i
!=
shorts
.
end
())
{
...
@@ -256,13 +256,13 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
...
@@ -256,13 +256,13 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
// this short opt comes with a value (no space), e.g., -x2
// this short opt comes with a value (no space), e.g., -x2
if
(
!
i
->
second
->
fun
(
arg
.
substr
(
2
)))
{
if
(
!
i
->
second
->
fun
(
arg
.
substr
(
2
)))
{
error
=
"invalid value for "
+
i
->
second
->
name
+
": "
+
arg
;
error
=
"invalid value for "
+
i
->
second
->
name
+
": "
+
arg
;
return
skip
_message
();
return
skip
();
}
}
insert_opt_name
(
i
->
second
);
insert_opt_name
(
i
->
second
);
return
none
;
return
none
;
}
}
// no value given, try two-argument form below
// no value given, try two-argument form below
return
skip
_message
();
return
skip
();
}
}
insert_opt_name
(
i
->
second
);
insert_opt_name
(
i
->
second
);
return
none
;
return
none
;
...
@@ -273,11 +273,11 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
...
@@ -273,11 +273,11 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
if
(
j
->
second
->
fun
)
{
if
(
j
->
second
->
fun
)
{
if
(
eq_pos
==
std
::
string
::
npos
)
{
if
(
eq_pos
==
std
::
string
::
npos
)
{
error
=
"missing argument to "
+
arg
;
error
=
"missing argument to "
+
arg
;
return
skip
_message
();
return
skip
();
}
}
if
(
!
j
->
second
->
fun
(
arg
.
substr
(
eq_pos
+
1
)))
{
if
(
!
j
->
second
->
fun
(
arg
.
substr
(
eq_pos
+
1
)))
{
error
=
"invalid value for "
+
j
->
second
->
name
+
": "
+
arg
;
error
=
"invalid value for "
+
j
->
second
->
name
+
": "
+
arg
;
return
skip
_message
();
return
skip
();
}
}
insert_opt_name
(
j
->
second
);
insert_opt_name
(
j
->
second
);
return
none
;
return
none
;
...
@@ -286,12 +286,12 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
...
@@ -286,12 +286,12 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
return
none
;
return
none
;
}
}
error
=
"unknown command line option: "
+
arg
;
error
=
"unknown command line option: "
+
arg
;
return
skip
_message
();
return
skip
();
},
},
[
&
](
const
std
::
string
&
arg1
,
[
&
](
const
std
::
string
&
arg1
,
const
std
::
string
&
arg2
)
->
optional
<
skip_
message_
t
>
{
const
std
::
string
&
arg2
)
->
optional
<
skip_t
>
{
if
(
arg1
.
size
()
<
2
||
arg1
[
0
]
!=
'-'
||
arg1
[
1
]
==
'-'
)
{
if
(
arg1
.
size
()
<
2
||
arg1
[
0
]
!=
'-'
||
arg1
[
1
]
==
'-'
)
{
return
skip
_message
();
return
skip
();
}
}
auto
i
=
shorts
.
find
(
arg1
.
substr
(
0
,
2
));
auto
i
=
shorts
.
find
(
arg1
.
substr
(
0
,
2
));
if
(
i
!=
shorts
.
end
())
{
if
(
i
!=
shorts
.
end
())
{
...
@@ -299,18 +299,18 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
...
@@ -299,18 +299,18 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
// this short opt either expects no argument or comes with a value
// this short opt either expects no argument or comes with a value
// (no space), e.g., -x2, so we have to parse it with the
// (no space), e.g., -x2, so we have to parse it with the
// one-argument form above
// one-argument form above
return
skip
_message
();
return
skip
();
}
}
CAF_ASSERT
(
arg1
.
size
()
==
2
);
CAF_ASSERT
(
arg1
.
size
()
==
2
);
if
(
!
i
->
second
->
fun
(
arg2
))
{
if
(
!
i
->
second
->
fun
(
arg2
))
{
error
=
"invalid value for option "
+
i
->
second
->
name
+
": "
+
arg2
;
error
=
"invalid value for option "
+
i
->
second
->
name
+
": "
+
arg2
;
return
skip
_message
();
return
skip
();
}
}
insert_opt_name
(
i
->
second
);
insert_opt_name
(
i
->
second
);
return
none
;
return
none
;
}
}
error
=
"unknown command line option: "
+
arg1
;
error
=
"unknown command line option: "
+
arg1
;
return
skip
_message
();
return
skip
();
}
}
});
});
return
{
res
,
std
::
move
(
opts
),
std
::
move
(
helpstr
),
std
::
move
(
error
)};
return
{
res
,
std
::
move
(
opts
),
std
::
move
(
helpstr
),
std
::
move
(
error
)};
...
...
libcaf_core/src/skip.cpp
0 → 100644
View file @
2c5604c6
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* 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/skip.hpp"
#include "caf/result.hpp"
#include "caf/message.hpp"
namespace
caf
{
result
<
message
>
skip_t
::
skip_fun_impl
(
local_actor
*
,
const
type_erased_tuple
*
)
{
return
skip
();
}
skip_t
::
operator
fun
()
const
{
return
skip_fun_impl
;
}
}
// namespace caf
libcaf_core/src/splitter.cpp
View file @
2c5604c6
...
@@ -65,7 +65,7 @@ behavior fan_out_fan_in(stateful_actor<splitter_state>* self,
...
@@ -65,7 +65,7 @@ behavior fan_out_fan_in(stateful_actor<splitter_state>* self,
);
);
return
delegated
<
message
>
{};
return
delegated
<
message
>
{};
};
};
self
->
set_
unexpected
_handler
(
f
);
self
->
set_
default
_handler
(
f
);
return
[]
{
return
[]
{
// nop
// nop
};
};
...
@@ -85,7 +85,7 @@ behavior fan_out_fan_in(stateful_actor<splitter_state>* self,
...
@@ -85,7 +85,7 @@ behavior fan_out_fan_in(stateful_actor<splitter_state>* self,
}
}
);
);
};
};
set_
unexpected
_handler(f);
set_
default
_handler(f);
return {
return {
others >> [=](const message& msg) {
others >> [=](const message& msg) {
self->state.rp = self->make_response_promise();
self->state.rp = self->make_response_promise();
...
...
libcaf_core/test/dynamic_spawn.cpp
View file @
2c5604c6
...
@@ -211,7 +211,7 @@ public:
...
@@ -211,7 +211,7 @@ public:
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
set_
unexpected_handler
(
reflect_unexpected
);
set_
default_handler
(
reflect
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
@@ -231,7 +231,7 @@ public:
...
@@ -231,7 +231,7 @@ public:
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
set_
unexpected_handler
(
reflect_unexpected
);
set_
default_handler
(
reflect
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
libcaf_core/test/message_lifetime.cpp
View file @
2c5604c6
...
@@ -43,7 +43,7 @@ public:
...
@@ -43,7 +43,7 @@ public:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
// reflecting a message increases its reference count by one
// reflecting a message increases its reference count by one
set_
unexpected_handler
(
reflect_unexpected
_and_quit
);
set_
default_handler
(
reflect
_and_quit
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
libcaf_core/test/metaprogramming.cpp
View file @
2c5604c6
...
@@ -49,7 +49,7 @@ CAF_TEST(metaprogramming) {
...
@@ -49,7 +49,7 @@ CAF_TEST(metaprogramming) {
using
if2
=
type_list
<
replies_to
<
int
>::
with
<
int
>
,
using
if2
=
type_list
<
replies_to
<
int
>::
with
<
int
>
,
replies_to
<
int
,
double
>::
with
<
void
>>
;
replies_to
<
int
,
double
>::
with
<
void
>>
;
using
if3
=
type_list
<
replies_to
<
int
,
double
>::
with
<
void
>>
;
using
if3
=
type_list
<
replies_to
<
int
,
double
>::
with
<
void
>>
;
using
if4
=
type_list
<
replies_to
<
int
>::
with
<
skip_
message_
t
>
,
using
if4
=
type_list
<
replies_to
<
int
>::
with
<
skip_t
>
,
replies_to
<
int
,
double
>::
with
<
void
>>
;
replies_to
<
int
,
double
>::
with
<
void
>>
;
CAF_CHECK_EQUAL
((
ctm
<
if1
,
if2
>::
value
),
-
1
);
CAF_CHECK_EQUAL
((
ctm
<
if1
,
if2
>::
value
),
-
1
);
CAF_CHECK_NOT_EQUAL
((
ctm
<
if1
,
if3
>::
value
),
-
1
);
CAF_CHECK_NOT_EQUAL
((
ctm
<
if1
,
if3
>::
value
),
-
1
);
...
...
libcaf_core/test/request.cpp
View file @
2c5604c6
...
@@ -49,7 +49,7 @@ struct sync_mirror : event_based_actor {
...
@@ -49,7 +49,7 @@ struct sync_mirror : event_based_actor {
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
set_
unexpected_handler
(
reflect_unexpected
);
set_
default_handler
(
reflect
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
@@ -82,7 +82,7 @@ public:
...
@@ -82,7 +82,7 @@ public:
:
event_based_actor
(
cfg
),
:
event_based_actor
(
cfg
),
buddy_
(
buddy_arg
)
{
buddy_
(
buddy_arg
)
{
// don't pollute unit test output with (provoked) warnings
// don't pollute unit test output with (provoked) warnings
set_
unexpected_handler
(
drop_unexpected
);
set_
default_handler
(
drop
);
}
}
inline
const
actor
&
buddy
()
const
{
inline
const
actor
&
buddy
()
const
{
...
@@ -145,7 +145,7 @@ class C : public event_based_actor {
...
@@ -145,7 +145,7 @@ class C : public event_based_actor {
public:
public:
C
(
actor_config
&
cfg
)
:
event_based_actor
(
cfg
)
{
C
(
actor_config
&
cfg
)
:
event_based_actor
(
cfg
)
{
// don't pollute unit test output with (provoked) warnings
// don't pollute unit test output with (provoked) warnings
set_
unexpected_handler
(
drop_unexpected
);
set_
default_handler
(
drop
);
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
...
@@ -223,12 +223,12 @@ printf("server id: %d\n", (int) self->id());
...
@@ -223,12 +223,12 @@ printf("server id: %d\n", (int) self->id());
return
self
->
delegate
(
worker
,
task
);
return
self
->
delegate
(
worker
,
task
);
},
},
[](
idle_atom
)
{
[](
idle_atom
)
{
return
skip
_message
();
return
skip
();
}
}
);
);
},
},
[](
request_atom
)
{
[](
request_atom
)
{
return
skip
_message
();
return
skip
();
}
}
};
};
}
}
...
@@ -261,7 +261,7 @@ CAF_TEST(test_void_res) {
...
@@ -261,7 +261,7 @@ CAF_TEST(test_void_res) {
CAF_TEST
(
pending_quit
)
{
CAF_TEST
(
pending_quit
)
{
auto
mirror
=
system
.
spawn
([](
event_based_actor
*
self
)
->
behavior
{
auto
mirror
=
system
.
spawn
([](
event_based_actor
*
self
)
->
behavior
{
self
->
set_
unexpected_handler
(
reflect_unexpected
);
self
->
set_
default_handler
(
reflect
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
libcaf_core/test/serial_reply.cpp
View file @
2c5604c6
...
@@ -42,7 +42,7 @@ using sub4_atom = atom_constant<atom("sub4")>;
...
@@ -42,7 +42,7 @@ using sub4_atom = atom_constant<atom("sub4")>;
CAF_TEST
(
test_serial_reply
)
{
CAF_TEST
(
test_serial_reply
)
{
actor_system
system
;
actor_system
system
;
auto
mirror_behavior
=
[
=
](
event_based_actor
*
self
)
->
behavior
{
auto
mirror_behavior
=
[
=
](
event_based_actor
*
self
)
->
behavior
{
self
->
set_
unexpected_handler
(
reflect_unexpected
);
self
->
set_
default_handler
(
reflect
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
libcaf_core/test/splitter.cpp
View file @
2c5604c6
...
@@ -74,9 +74,9 @@ struct fixture {
...
@@ -74,9 +74,9 @@ struct fixture {
void
await_down
(
const
actor
&
x
)
{
void
await_down
(
const
actor
&
x
)
{
self
->
monitor
(
x
);
self
->
monitor
(
x
);
self
->
receive
(
self
->
receive
(
[
&
](
const
down_msg
&
dm
)
->
optional
<
skip_
message_
t
>
{
[
&
](
const
down_msg
&
dm
)
->
optional
<
skip_t
>
{
if
(
dm
.
source
!=
x
)
if
(
dm
.
source
!=
x
)
return
skip
_message
();
return
skip
();
return
none
;
return
none
;
}
}
);
);
...
...
libcaf_core/test/typed_spawn.cpp
View file @
2c5604c6
...
@@ -192,10 +192,10 @@ public:
...
@@ -192,10 +192,10 @@ public:
become
(
wait4int
());
become
(
wait4int
());
},
},
[](
float
)
{
[](
float
)
{
return
skip
_message
();
return
skip
();
},
},
[](
int
)
{
[](
int
)
{
return
skip
_message
();
return
skip
();
}
}
};
};
}
}
...
@@ -210,10 +210,10 @@ public:
...
@@ -210,10 +210,10 @@ public:
return
42
;
return
42
;
},
},
[](
float
)
{
[](
float
)
{
return
skip
_message
();
return
skip
();
},
},
[](
const
string
&
)
{
[](
const
string
&
)
{
return
skip
_message
();
return
skip
();
}
}
};
};
}
}
...
@@ -227,10 +227,10 @@ public:
...
@@ -227,10 +227,10 @@ public:
become
(
wait4string
());
become
(
wait4string
());
},
},
[](
const
string
&
)
{
[](
const
string
&
)
{
return
skip
_message
();
return
skip
();
},
},
[](
int
)
{
[](
int
)
{
return
skip
_message
();
return
skip
();
}
}
};
};
}
}
...
...
libcaf_io/src/basp_broker.cpp
View file @
2c5604c6
...
@@ -264,13 +264,13 @@ void basp_broker_state::learned_new_node(const node_id& nid) {
...
@@ -264,13 +264,13 @@ void basp_broker_state::learned_new_node(const node_id& nid) {
tmp
=
system
().
spawn
<
hidden
>
([
=
](
event_based_actor
*
this_actor
)
->
behavior
{
tmp
=
system
().
spawn
<
hidden
>
([
=
](
event_based_actor
*
this_actor
)
->
behavior
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
// skip messages until we receive the initial ok_atom
// skip messages until we receive the initial ok_atom
this_actor
->
set_
unexpected_handler
(
skip_unexpected
);
this_actor
->
set_
default_handler
(
skip
);
return
{
return
{
[
=
](
ok_atom
,
const
std
::
string
&
/* key == "info" */
,
[
=
](
ok_atom
,
const
std
::
string
&
/* key == "info" */
,
const
actor_addr
&
config_serv_addr
,
const
std
::
string
&
/* name */
)
{
const
actor_addr
&
config_serv_addr
,
const
std
::
string
&
/* name */
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
config_serv_addr
));
CAF_LOG_TRACE
(
CAF_ARG
(
config_serv_addr
));
// drop unexpected messages from this point on
// drop unexpected messages from this point on
this_actor
->
set_
unexpected_handler
(
print_and_drop_unexpected
);
this_actor
->
set_
default_handler
(
print_and_drop
);
auto
config_serv
=
actor_cast
<
actor
>
(
config_serv_addr
);
auto
config_serv
=
actor_cast
<
actor
>
(
config_serv_addr
);
this_actor
->
monitor
(
config_serv
);
this_actor
->
monitor
(
config_serv
);
this_actor
->
become
(
this_actor
->
become
(
...
...
libcaf_io/test/basp.cpp
View file @
2c5604c6
...
@@ -644,7 +644,7 @@ CAF_TEST(remote_actor_and_send) {
...
@@ -644,7 +644,7 @@ CAF_TEST(remote_actor_and_send) {
CAF_TEST
(
actor_serialize_and_deserialize
)
{
CAF_TEST
(
actor_serialize_and_deserialize
)
{
auto
testee_impl
=
[](
event_based_actor
*
testee_self
)
->
behavior
{
auto
testee_impl
=
[](
event_based_actor
*
testee_self
)
->
behavior
{
testee_self
->
set_
unexpected_handler
(
reflect_unexpected
_and_quit
);
testee_self
->
set_
default_handler
(
reflect
_and_quit
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
libcaf_io/test/remote_group.cpp
View file @
2c5604c6
...
@@ -49,7 +49,7 @@ struct fixture {
...
@@ -49,7 +49,7 @@ struct fixture {
};
};
behavior
make_reflector_behavior
(
event_based_actor
*
self
)
{
behavior
make_reflector_behavior
(
event_based_actor
*
self
)
{
self
->
set_
unexpected_handler
(
reflect_unexpected
_and_quit
);
self
->
set_
default_handler
(
reflect
_and_quit
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
@@ -85,7 +85,7 @@ struct await_reflector_reply_behavior {
...
@@ -85,7 +85,7 @@ struct await_reflector_reply_behavior {
// `grp` may be either local or remote
// `grp` may be either local or remote
void
make_client_behavior
(
event_based_actor
*
self
,
void
make_client_behavior
(
event_based_actor
*
self
,
actor
server
,
group
grp
)
{
actor
server
,
group
grp
)
{
self
->
set_
unexpected_handler
(
skip_unexpected
);
self
->
set_
default_handler
(
skip
);
self
->
spawn_in_group
(
grp
,
make_reflector_behavior
);
self
->
spawn_in_group
(
grp
,
make_reflector_behavior
);
self
->
spawn_in_group
(
grp
,
make_reflector_behavior
);
self
->
spawn_in_group
(
grp
,
make_reflector_behavior
);
self
->
request
(
server
,
infinite
,
spawn_atom
::
value
,
grp
).
then
(
self
->
request
(
server
,
infinite
,
spawn_atom
::
value
,
grp
).
then
(
...
...
libcaf_io/test/remote_spawn.cpp
View file @
2c5604c6
...
@@ -37,7 +37,7 @@ using namespace caf;
...
@@ -37,7 +37,7 @@ using namespace caf;
namespace
{
namespace
{
behavior
mirror
(
event_based_actor
*
self
)
{
behavior
mirror
(
event_based_actor
*
self
)
{
self
->
set_
unexpected_handler
(
reflect_unexpected
);
self
->
set_
default_handler
(
reflect
);
return
{
return
{
[]
{
[]
{
// nop
// nop
...
...
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