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
23f6f248
Commit
23f6f248
authored
Mar 13, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename CAF_REQUIRE to CAF_ASSERT
parent
d8e5811e
Changes
43
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
168 additions
and
168 deletions
+168
-168
libcaf_core/caf/config.hpp
libcaf_core/caf/config.hpp
+3
-3
libcaf_core/caf/detail/behavior_stack.hpp
libcaf_core/caf/detail/behavior_stack.hpp
+1
-1
libcaf_core/caf/detail/double_ended_queue.hpp
libcaf_core/caf/detail/double_ended_queue.hpp
+7
-7
libcaf_core/caf/detail/limited_vector.hpp
libcaf_core/caf/detail/limited_vector.hpp
+12
-12
libcaf_core/caf/detail/memory.hpp
libcaf_core/caf/detail/memory.hpp
+2
-2
libcaf_core/caf/detail/pseudo_tuple.hpp
libcaf_core/caf/detail/pseudo_tuple.hpp
+2
-2
libcaf_core/caf/detail/single_reader_queue.hpp
libcaf_core/caf/detail/single_reader_queue.hpp
+12
-12
libcaf_core/caf/detail/tuple_vals.hpp
libcaf_core/caf/detail/tuple_vals.hpp
+3
-3
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+2
-2
libcaf_core/caf/optional.hpp
libcaf_core/caf/optional.hpp
+13
-13
libcaf_core/caf/scheduler/coordinator.hpp
libcaf_core/caf/scheduler/coordinator.hpp
+1
-1
libcaf_core/caf/scheduler/profiled_coordinator.hpp
libcaf_core/caf/scheduler/profiled_coordinator.hpp
+1
-1
libcaf_core/caf/scheduler/worker.hpp
libcaf_core/caf/scheduler/worker.hpp
+4
-4
libcaf_core/caf/string_algorithms.hpp
libcaf_core/caf/string_algorithms.hpp
+1
-1
libcaf_core/caf/uniform_type_info.hpp
libcaf_core/caf/uniform_type_info.hpp
+1
-1
libcaf_core/src/abstract_actor.cpp
libcaf_core/src/abstract_actor.cpp
+2
-2
libcaf_core/src/actor_namespace.cpp
libcaf_core/src/actor_namespace.cpp
+2
-2
libcaf_core/src/actor_pool.cpp
libcaf_core/src/actor_pool.cpp
+2
-2
libcaf_core/src/actor_registry.cpp
libcaf_core/src/actor_registry.cpp
+1
-1
libcaf_core/src/behavior_impl.cpp
libcaf_core/src/behavior_impl.cpp
+1
-1
libcaf_core/src/concatenated_tuple.cpp
libcaf_core/src/concatenated_tuple.cpp
+4
-4
libcaf_core/src/decorated_tuple.cpp
libcaf_core/src/decorated_tuple.cpp
+3
-3
libcaf_core/src/default_attachable.cpp
libcaf_core/src/default_attachable.cpp
+1
-1
libcaf_core/src/forwarding_actor_proxy.cpp
libcaf_core/src/forwarding_actor_proxy.cpp
+1
-1
libcaf_core/src/group_manager.cpp
libcaf_core/src/group_manager.cpp
+3
-3
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+11
-11
libcaf_core/src/logging.cpp
libcaf_core/src/logging.cpp
+1
-1
libcaf_core/src/message.cpp
libcaf_core/src/message.cpp
+5
-5
libcaf_core/src/message_builder.cpp
libcaf_core/src/message_builder.cpp
+3
-3
libcaf_core/src/response_promise.cpp
libcaf_core/src/response_promise.cpp
+1
-1
libcaf_core/src/singletons.cpp
libcaf_core/src/singletons.cpp
+1
-1
libcaf_core/src/sync_request_bouncer.cpp
libcaf_core/src/sync_request_bouncer.cpp
+1
-1
libcaf_core/src/try_match.cpp
libcaf_core/src/try_match.cpp
+4
-4
libcaf_core/src/uniform_type_info.cpp
libcaf_core/src/uniform_type_info.cpp
+1
-1
libcaf_core/src/uniform_type_info_map.cpp
libcaf_core/src/uniform_type_info_map.cpp
+5
-5
libcaf_io/caf/io/broker.hpp
libcaf_io/caf/io/broker.hpp
+1
-1
libcaf_io/caf/io/middleman.hpp
libcaf_io/caf/io/middleman.hpp
+1
-1
libcaf_io/caf/io/network/default_multiplexer.hpp
libcaf_io/caf/io/network/default_multiplexer.hpp
+6
-6
libcaf_io/caf/io/receive_policy.hpp
libcaf_io/caf/io/receive_policy.hpp
+3
-3
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+19
-19
libcaf_io/src/broker.cpp
libcaf_io/src/broker.cpp
+3
-3
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+15
-15
libcaf_io/src/middleman.cpp
libcaf_io/src/middleman.cpp
+2
-2
No files found.
libcaf_core/caf/config.hpp
View file @
23f6f248
...
@@ -123,16 +123,16 @@
...
@@ -123,16 +123,16 @@
// import backtrace and backtrace_symbols_fd into caf::detail
// import backtrace and backtrace_symbols_fd into caf::detail
#ifndef CAF_ENABLE_RUNTIME_CHECKS
#ifndef CAF_ENABLE_RUNTIME_CHECKS
# define CAF_
REQUIRE
(unused) static_cast<void>(0)
# define CAF_
ASSERT
(unused) static_cast<void>(0)
#elif defined(CAF_WINDOWS) || defined(CAF_BSD)
#elif defined(CAF_WINDOWS) || defined(CAF_BSD)
# define CAF_
REQUIRE(stmt)
\
# define CAF_
ASSERT(stmt)
\
if (static_cast<bool>(stmt) == false) { \
if (static_cast<bool>(stmt) == false) { \
printf("%s:%u: requirement failed '%s'\n", __FILE__, __LINE__, #stmt); \
printf("%s:%u: requirement failed '%s'\n", __FILE__, __LINE__, #stmt); \
abort(); \
abort(); \
} static_cast<void>(0)
} static_cast<void>(0)
#else // defined(CAF_LINUX) || defined(CAF_MACOS)
#else // defined(CAF_LINUX) || defined(CAF_MACOS)
# include <execinfo.h>
# include <execinfo.h>
# define CAF_
REQUIRE(stmt)
\
# define CAF_
ASSERT(stmt)
\
if (static_cast<bool>(stmt) == false) { \
if (static_cast<bool>(stmt) == false) { \
printf("%s:%u: requirement failed '%s'\n", __FILE__, __LINE__, #stmt); \
printf("%s:%u: requirement failed '%s'\n", __FILE__, __LINE__, #stmt); \
void* array[10]; \
void* array[10]; \
...
...
libcaf_core/caf/detail/behavior_stack.hpp
View file @
23f6f248
...
@@ -56,7 +56,7 @@ class behavior_stack {
...
@@ -56,7 +56,7 @@ class behavior_stack {
}
}
inline
behavior
&
back
()
{
inline
behavior
&
back
()
{
CAF_
REQUIRE
(
!
empty
());
CAF_
ASSERT
(
!
empty
());
return
m_elements
.
back
();
return
m_elements
.
back
();
}
}
...
...
libcaf_core/caf/detail/double_ended_queue.hpp
View file @
23f6f248
...
@@ -127,7 +127,7 @@ class double_ended_queue {
...
@@ -127,7 +127,7 @@ class double_ended_queue {
// acquires only one lock
// acquires only one lock
void
append
(
pointer
value
)
{
void
append
(
pointer
value
)
{
CAF_
REQUIRE
(
value
!=
nullptr
);
CAF_
ASSERT
(
value
!=
nullptr
);
node
*
tmp
=
new
node
(
value
);
node
*
tmp
=
new
node
(
value
);
lock_guard
guard
(
m_tail_lock
);
lock_guard
guard
(
m_tail_lock
);
// publish & swing last forward
// publish & swing last forward
...
@@ -137,23 +137,23 @@ class double_ended_queue {
...
@@ -137,23 +137,23 @@ class double_ended_queue {
// acquires both locks
// acquires both locks
void
prepend
(
pointer
value
)
{
void
prepend
(
pointer
value
)
{
CAF_
REQUIRE
(
value
!=
nullptr
);
CAF_
ASSERT
(
value
!=
nullptr
);
node
*
tmp
=
new
node
(
value
);
node
*
tmp
=
new
node
(
value
);
node
*
first
=
nullptr
;
node
*
first
=
nullptr
;
// acquire both locks since we might touch m_last too
// acquire both locks since we might touch m_last too
lock_guard
guard1
(
m_head_lock
);
lock_guard
guard1
(
m_head_lock
);
lock_guard
guard2
(
m_tail_lock
);
lock_guard
guard2
(
m_tail_lock
);
first
=
m_head
.
load
();
first
=
m_head
.
load
();
CAF_
REQUIRE
(
first
!=
nullptr
);
CAF_
ASSERT
(
first
!=
nullptr
);
auto
next
=
first
->
next
.
load
();
auto
next
=
first
->
next
.
load
();
// m_first always points to a dummy with no value,
// m_first always points to a dummy with no value,
// hence we put the new element second
// hence we put the new element second
if
(
next
==
nullptr
)
{
if
(
next
==
nullptr
)
{
// queue is empty
// queue is empty
CAF_
REQUIRE
(
first
==
m_tail
);
CAF_
ASSERT
(
first
==
m_tail
);
m_tail
=
tmp
;
m_tail
=
tmp
;
}
else
{
}
else
{
CAF_
REQUIRE
(
first
!=
m_tail
);
CAF_
ASSERT
(
first
!=
m_tail
);
tmp
->
next
=
next
;
tmp
->
next
=
next
;
}
}
first
->
next
=
tmp
;
first
->
next
=
tmp
;
...
@@ -187,7 +187,7 @@ class double_ended_queue {
...
@@ -187,7 +187,7 @@ class double_ended_queue {
{
// lifetime scope of guards
{
// lifetime scope of guards
lock_guard
guard1
(
m_head_lock
);
lock_guard
guard1
(
m_head_lock
);
lock_guard
guard2
(
m_tail_lock
);
lock_guard
guard2
(
m_tail_lock
);
CAF_
REQUIRE
(
m_head
!=
nullptr
);
CAF_
ASSERT
(
m_head
!=
nullptr
);
last
.
reset
(
m_tail
.
load
());
last
.
reset
(
m_tail
.
load
());
if
(
last
.
get
()
==
m_head
.
load
())
{
if
(
last
.
get
()
==
m_head
.
load
())
{
last
.
release
();
last
.
release
();
...
@@ -195,7 +195,7 @@ class double_ended_queue {
...
@@ -195,7 +195,7 @@ class double_ended_queue {
}
}
result
=
last
->
value
;
result
=
last
->
value
;
m_tail
=
find_predecessor
(
last
.
get
());
m_tail
=
find_predecessor
(
last
.
get
());
CAF_
REQUIRE
(
m_tail
!=
nullptr
);
CAF_
ASSERT
(
m_tail
!=
nullptr
);
m_tail
.
load
()
->
next
=
nullptr
;
m_tail
.
load
()
->
next
=
nullptr
;
}
}
return
result
;
return
result
;
...
...
libcaf_core/caf/detail/limited_vector.hpp
View file @
23f6f248
...
@@ -72,12 +72,12 @@ class limited_vector {
...
@@ -72,12 +72,12 @@ class limited_vector {
}
}
void
resize
(
size_type
s
)
{
void
resize
(
size_type
s
)
{
CAF_
REQUIRE
(
s
<=
MaxSize
);
CAF_
ASSERT
(
s
<=
MaxSize
);
m_size
=
s
;
m_size
=
s
;
}
}
limited_vector
(
std
::
initializer_list
<
T
>
init
)
:
m_size
(
init
.
size
())
{
limited_vector
(
std
::
initializer_list
<
T
>
init
)
:
m_size
(
init
.
size
())
{
CAF_
REQUIRE
(
init
.
size
()
<=
MaxSize
);
CAF_
ASSERT
(
init
.
size
()
<=
MaxSize
);
std
::
copy
(
init
.
begin
(),
init
.
end
(),
begin
());
std
::
copy
(
init
.
begin
(),
init
.
end
(),
begin
());
}
}
...
@@ -91,7 +91,7 @@ class limited_vector {
...
@@ -91,7 +91,7 @@ class limited_vector {
// dummy SFINAE argument
// dummy SFINAE argument
typename
std
::
iterator_traits
<
InputIterator
>::
pointer
=
0
)
{
typename
std
::
iterator_traits
<
InputIterator
>::
pointer
=
0
)
{
auto
dist
=
std
::
distance
(
first
,
last
);
auto
dist
=
std
::
distance
(
first
,
last
);
CAF_
REQUIRE
(
dist
>=
0
);
CAF_
ASSERT
(
dist
>=
0
);
resize
(
static_cast
<
size_t
>
(
dist
));
resize
(
static_cast
<
size_t
>
(
dist
));
std
::
copy
(
first
,
last
,
begin
());
std
::
copy
(
first
,
last
,
begin
());
}
}
...
@@ -121,22 +121,22 @@ class limited_vector {
...
@@ -121,22 +121,22 @@ class limited_vector {
}
}
void
push_back
(
const_reference
what
)
{
void
push_back
(
const_reference
what
)
{
CAF_
REQUIRE
(
!
full
());
CAF_
ASSERT
(
!
full
());
m_data
[
m_size
++
]
=
what
;
m_data
[
m_size
++
]
=
what
;
}
}
void
pop_back
()
{
void
pop_back
()
{
CAF_
REQUIRE
(
!
empty
());
CAF_
ASSERT
(
!
empty
());
--
m_size
;
--
m_size
;
}
}
reference
at
(
size_type
pos
)
{
reference
at
(
size_type
pos
)
{
CAF_
REQUIRE
(
pos
<
m_size
);
CAF_
ASSERT
(
pos
<
m_size
);
return
m_data
[
pos
];
return
m_data
[
pos
];
}
}
const_reference
at
(
size_type
pos
)
const
{
const_reference
at
(
size_type
pos
)
const
{
CAF_
REQUIRE
(
pos
<
m_size
);
CAF_
ASSERT
(
pos
<
m_size
);
return
m_data
[
pos
];
return
m_data
[
pos
];
}
}
...
@@ -197,22 +197,22 @@ class limited_vector {
...
@@ -197,22 +197,22 @@ class limited_vector {
}
}
reference
front
()
{
reference
front
()
{
CAF_
REQUIRE
(
!
empty
());
CAF_
ASSERT
(
!
empty
());
return
m_data
[
0
];
return
m_data
[
0
];
}
}
const_reference
front
()
const
{
const_reference
front
()
const
{
CAF_
REQUIRE
(
!
empty
());
CAF_
ASSERT
(
!
empty
());
return
m_data
[
0
];
return
m_data
[
0
];
}
}
reference
back
()
{
reference
back
()
{
CAF_
REQUIRE
(
!
empty
());
CAF_
ASSERT
(
!
empty
());
return
m_data
[
m_size
-
1
];
return
m_data
[
m_size
-
1
];
}
}
const_reference
back
()
const
{
const_reference
back
()
const
{
CAF_
REQUIRE
(
!
empty
());
CAF_
ASSERT
(
!
empty
());
return
m_data
[
m_size
-
1
];
return
m_data
[
m_size
-
1
];
}
}
...
@@ -226,7 +226,7 @@ class limited_vector {
...
@@ -226,7 +226,7 @@ class limited_vector {
template
<
class
InputIterator
>
template
<
class
InputIterator
>
void
insert
(
iterator
pos
,
InputIterator
first
,
InputIterator
last
)
{
void
insert
(
iterator
pos
,
InputIterator
first
,
InputIterator
last
)
{
CAF_
REQUIRE
(
first
<=
last
);
CAF_
ASSERT
(
first
<=
last
);
auto
num_elements
=
static_cast
<
size_t
>
(
std
::
distance
(
first
,
last
));
auto
num_elements
=
static_cast
<
size_t
>
(
std
::
distance
(
first
,
last
));
if
((
size
()
+
num_elements
)
>
MaxSize
)
{
if
((
size
()
+
num_elements
)
>
MaxSize
)
{
throw
std
::
length_error
(
"limited_vector::insert: too much elements"
);
throw
std
::
length_error
(
"limited_vector::insert: too much elements"
);
...
...
libcaf_core/caf/detail/memory.hpp
View file @
23f6f248
...
@@ -68,7 +68,7 @@ struct rc_storage : public ref_counted {
...
@@ -68,7 +68,7 @@ struct rc_storage : public ref_counted {
rc_storage
(
Ts
&&
...
xs
)
rc_storage
(
Ts
&&
...
xs
)
:
instance
(
intrusive_ptr
<
ref_counted
>
(
this
,
false
),
:
instance
(
intrusive_ptr
<
ref_counted
>
(
this
,
false
),
std
::
forward
<
Ts
>
(
xs
)...)
{
std
::
forward
<
Ts
>
(
xs
)...)
{
CAF_
REQUIRE
(
get_reference_count
()
>=
1
);
CAF_
ASSERT
(
get_reference_count
()
>=
1
);
}
}
};
};
...
@@ -162,7 +162,7 @@ class basic_memory_cache : public memory_cache {
...
@@ -162,7 +162,7 @@ class basic_memory_cache : public memory_cache {
// allocate cache on-the-fly
// allocate cache on-the-fly
if
(
!
m_cache
)
{
if
(
!
m_cache
)
{
m_cache
.
reset
(
new
storage
,
false
);
// starts with ref count of 1
m_cache
.
reset
(
new
storage
,
false
);
// starts with ref count of 1
CAF_
REQUIRE
(
m_cache
->
unique
());
CAF_
ASSERT
(
m_cache
->
unique
());
}
}
auto
res
=
m_cache
->
next
();
auto
res
=
m_cache
->
next
();
if
(
m_cache
->
has_next
())
{
if
(
m_cache
->
has_next
())
{
...
...
libcaf_core/caf/detail/pseudo_tuple.hpp
View file @
23f6f248
...
@@ -48,7 +48,7 @@ const typename detail::type_at<N, Ts...>::type&
...
@@ -48,7 +48,7 @@ const typename detail::type_at<N, Ts...>::type&
get
(
const
detail
::
pseudo_tuple
<
Ts
...
>&
tv
)
{
get
(
const
detail
::
pseudo_tuple
<
Ts
...
>&
tv
)
{
static_assert
(
N
<
sizeof
...(
Ts
),
"N >= tv.size()"
);
static_assert
(
N
<
sizeof
...(
Ts
),
"N >= tv.size()"
);
auto
vp
=
tv
.
at
(
N
);
auto
vp
=
tv
.
at
(
N
);
CAF_
REQUIRE
(
vp
!=
nullptr
);
CAF_
ASSERT
(
vp
!=
nullptr
);
return
*
reinterpret_cast
<
const
typename
detail
::
type_at
<
N
,
Ts
...
>::
type
*>
(
vp
);
return
*
reinterpret_cast
<
const
typename
detail
::
type_at
<
N
,
Ts
...
>::
type
*>
(
vp
);
}
}
...
@@ -56,7 +56,7 @@ template <size_t N, class... Ts>
...
@@ -56,7 +56,7 @@ template <size_t N, class... Ts>
typename
detail
::
type_at
<
N
,
Ts
...
>::
type
&
get
(
detail
::
pseudo_tuple
<
Ts
...
>&
tv
)
{
typename
detail
::
type_at
<
N
,
Ts
...
>::
type
&
get
(
detail
::
pseudo_tuple
<
Ts
...
>&
tv
)
{
static_assert
(
N
<
sizeof
...(
Ts
),
"N >= tv.size()"
);
static_assert
(
N
<
sizeof
...(
Ts
),
"N >= tv.size()"
);
auto
vp
=
tv
.
mutable_at
(
N
);
auto
vp
=
tv
.
mutable_at
(
N
);
CAF_
REQUIRE
(
vp
!=
nullptr
);
CAF_
ASSERT
(
vp
!=
nullptr
);
return
*
reinterpret_cast
<
typename
detail
::
type_at
<
N
,
Ts
...
>::
type
*>
(
vp
);
return
*
reinterpret_cast
<
typename
detail
::
type_at
<
N
,
Ts
...
>::
type
*>
(
vp
);
}
}
...
...
libcaf_core/caf/detail/single_reader_queue.hpp
View file @
23f6f248
...
@@ -83,7 +83,7 @@ class single_reader_queue {
...
@@ -83,7 +83,7 @@ class single_reader_queue {
* @warning Call only from the reader (owner).
* @warning Call only from the reader (owner).
*/
*/
enqueue_result
enqueue
(
pointer
new_element
)
{
enqueue_result
enqueue
(
pointer
new_element
)
{
CAF_
REQUIRE
(
new_element
!=
nullptr
);
CAF_
ASSERT
(
new_element
!=
nullptr
);
pointer
e
=
m_stack
.
load
();
pointer
e
=
m_stack
.
load
();
for
(;;)
{
for
(;;)
{
if
(
!
e
)
{
if
(
!
e
)
{
...
@@ -111,7 +111,7 @@ class single_reader_queue {
...
@@ -111,7 +111,7 @@ class single_reader_queue {
return
true
;
return
true
;
}
}
auto
ptr
=
m_stack
.
load
();
auto
ptr
=
m_stack
.
load
();
CAF_
REQUIRE
(
ptr
!=
nullptr
);
CAF_
ASSERT
(
ptr
!=
nullptr
);
return
!
is_dummy
(
ptr
);
return
!
is_dummy
(
ptr
);
}
}
...
@@ -120,7 +120,7 @@ class single_reader_queue {
...
@@ -120,7 +120,7 @@ class single_reader_queue {
* @warning Call only from the reader (owner).
* @warning Call only from the reader (owner).
*/
*/
bool
empty
()
{
bool
empty
()
{
CAF_
REQUIRE
(
!
closed
());
CAF_
ASSERT
(
!
closed
());
return
m_cache
.
empty
()
&&
m_head
==
nullptr
&&
is_dummy
(
m_stack
.
load
());
return
m_cache
.
empty
()
&&
m_head
==
nullptr
&&
is_dummy
(
m_stack
.
load
());
}
}
...
@@ -145,7 +145,7 @@ class single_reader_queue {
...
@@ -145,7 +145,7 @@ class single_reader_queue {
bool
try_block
()
{
bool
try_block
()
{
auto
e
=
stack_empty_dummy
();
auto
e
=
stack_empty_dummy
();
bool
res
=
m_stack
.
compare_exchange_strong
(
e
,
reader_blocked_dummy
());
bool
res
=
m_stack
.
compare_exchange_strong
(
e
,
reader_blocked_dummy
());
CAF_
REQUIRE
(
e
!=
nullptr
);
CAF_
ASSERT
(
e
!=
nullptr
);
// return true in case queue was already blocked
// return true in case queue was already blocked
return
res
||
e
==
reader_blocked_dummy
();
return
res
||
e
==
reader_blocked_dummy
();
}
}
...
@@ -239,7 +239,7 @@ class single_reader_queue {
...
@@ -239,7 +239,7 @@ class single_reader_queue {
template
<
class
Mutex
,
class
CondVar
>
template
<
class
Mutex
,
class
CondVar
>
void
synchronized_await
(
Mutex
&
mtx
,
CondVar
&
cv
)
{
void
synchronized_await
(
Mutex
&
mtx
,
CondVar
&
cv
)
{
CAF_
REQUIRE
(
!
closed
());
CAF_
ASSERT
(
!
closed
());
if
(
!
can_fetch_more
()
&&
try_block
())
{
if
(
!
can_fetch_more
()
&&
try_block
())
{
std
::
unique_lock
<
Mutex
>
guard
(
mtx
);
std
::
unique_lock
<
Mutex
>
guard
(
mtx
);
while
(
blocked
())
{
while
(
blocked
())
{
...
@@ -250,7 +250,7 @@ class single_reader_queue {
...
@@ -250,7 +250,7 @@ class single_reader_queue {
template
<
class
Mutex
,
class
CondVar
,
class
TimePoint
>
template
<
class
Mutex
,
class
CondVar
,
class
TimePoint
>
bool
synchronized_await
(
Mutex
&
mtx
,
CondVar
&
cv
,
const
TimePoint
&
timeout
)
{
bool
synchronized_await
(
Mutex
&
mtx
,
CondVar
&
cv
,
const
TimePoint
&
timeout
)
{
CAF_
REQUIRE
(
!
closed
());
CAF_
ASSERT
(
!
closed
());
if
(
!
can_fetch_more
()
&&
try_block
())
{
if
(
!
can_fetch_more
()
&&
try_block
())
{
std
::
unique_lock
<
Mutex
>
guard
(
mtx
);
std
::
unique_lock
<
Mutex
>
guard
(
mtx
);
while
(
blocked
())
{
while
(
blocked
())
{
...
@@ -275,26 +275,26 @@ class single_reader_queue {
...
@@ -275,26 +275,26 @@ class single_reader_queue {
// atomically sets m_stack back and enqueues all elements to the cache
// atomically sets m_stack back and enqueues all elements to the cache
bool
fetch_new_data
(
pointer
end_ptr
)
{
bool
fetch_new_data
(
pointer
end_ptr
)
{
CAF_
REQUIRE
(
end_ptr
==
nullptr
||
end_ptr
==
stack_empty_dummy
());
CAF_
ASSERT
(
end_ptr
==
nullptr
||
end_ptr
==
stack_empty_dummy
());
pointer
e
=
m_stack
.
load
();
pointer
e
=
m_stack
.
load
();
// must not be called on a closed queue
// must not be called on a closed queue
CAF_
REQUIRE
(
e
!=
nullptr
);
CAF_
ASSERT
(
e
!=
nullptr
);
// fetching data while blocked is an error
// fetching data while blocked is an error
CAF_
REQUIRE
(
e
!=
reader_blocked_dummy
());
CAF_
ASSERT
(
e
!=
reader_blocked_dummy
());
// it's enough to check this once, since only the owner is allowed
// it's enough to check this once, since only the owner is allowed
// to close the queue and only the owner is allowed to call this
// to close the queue and only the owner is allowed to call this
// member function
// member function
while
(
e
!=
end_ptr
)
{
while
(
e
!=
end_ptr
)
{
if
(
m_stack
.
compare_exchange_weak
(
e
,
end_ptr
))
{
if
(
m_stack
.
compare_exchange_weak
(
e
,
end_ptr
))
{
// fetching data while blocked is an error
// fetching data while blocked is an error
CAF_
REQUIRE
(
e
!=
reader_blocked_dummy
());
CAF_
ASSERT
(
e
!=
reader_blocked_dummy
());
if
(
is_dummy
(
e
))
{
if
(
is_dummy
(
e
))
{
// only use-case for this is closing a queue
// only use-case for this is closing a queue
CAF_
REQUIRE
(
end_ptr
==
nullptr
);
CAF_
ASSERT
(
end_ptr
==
nullptr
);
return
false
;
return
false
;
}
}
while
(
e
)
{
while
(
e
)
{
CAF_
REQUIRE
(
!
is_dummy
(
e
));
CAF_
ASSERT
(
!
is_dummy
(
e
));
auto
next
=
e
->
next
;
auto
next
=
e
->
next
;
e
->
next
=
m_head
;
e
->
next
=
m_head
;
m_head
=
e
;
m_head
=
e
;
...
...
libcaf_core/caf/detail/tuple_vals.hpp
View file @
23f6f248
...
@@ -103,18 +103,18 @@ class tuple_vals : public message_data {
...
@@ -103,18 +103,18 @@ class tuple_vals : public message_data {
}
}
const
void
*
at
(
size_t
pos
)
const
override
{
const
void
*
at
(
size_t
pos
)
const
override
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
return
tup_ptr_access
<
0
,
sizeof
...(
Ts
)
>::
get
(
pos
,
m_data
);
return
tup_ptr_access
<
0
,
sizeof
...(
Ts
)
>::
get
(
pos
,
m_data
);
}
}
void
*
mutable_at
(
size_t
pos
)
override
{
void
*
mutable_at
(
size_t
pos
)
override
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
return
const_cast
<
void
*>
(
at
(
pos
));
return
const_cast
<
void
*>
(
at
(
pos
));
}
}
bool
match_element
(
size_t
pos
,
uint16_t
typenr
,
bool
match_element
(
size_t
pos
,
uint16_t
typenr
,
const
std
::
type_info
*
rtti
)
const
override
{
const
std
::
type_info
*
rtti
)
const
override
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
auto
&
et
=
m_types
[
pos
];
auto
&
et
=
m_types
[
pos
];
if
(
et
.
first
!=
typenr
)
{
if
(
et
.
first
!=
typenr
)
{
return
false
;
return
false
;
...
...
libcaf_core/caf/message.hpp
View file @
23f6f248
...
@@ -148,7 +148,7 @@ class message {
...
@@ -148,7 +148,7 @@ class message {
*/
*/
template
<
class
T
>
template
<
class
T
>
const
T
&
get_as
(
size_t
p
)
const
{
const
T
&
get_as
(
size_t
p
)
const
{
CAF_
REQUIRE
(
match_element
(
p
,
detail
::
type_nr
<
T
>::
value
,
&
typeid
(
T
)));
CAF_
ASSERT
(
match_element
(
p
,
detail
::
type_nr
<
T
>::
value
,
&
typeid
(
T
)));
return
*
reinterpret_cast
<
const
T
*>
(
at
(
p
));
return
*
reinterpret_cast
<
const
T
*>
(
at
(
p
));
}
}
...
@@ -157,7 +157,7 @@ class message {
...
@@ -157,7 +157,7 @@ class message {
*/
*/
template
<
class
T
>
template
<
class
T
>
T
&
get_as_mutable
(
size_t
p
)
{
T
&
get_as_mutable
(
size_t
p
)
{
CAF_
REQUIRE
(
match_element
(
p
,
detail
::
type_nr
<
T
>::
value
,
&
typeid
(
T
)));
CAF_
ASSERT
(
match_element
(
p
,
detail
::
type_nr
<
T
>::
value
,
&
typeid
(
T
)));
return
*
reinterpret_cast
<
T
*>
(
mutable_at
(
p
));
return
*
reinterpret_cast
<
T
*>
(
mutable_at
(
p
));
}
}
...
...
libcaf_core/caf/optional.hpp
View file @
23f6f248
...
@@ -126,7 +126,7 @@ class optional {
...
@@ -126,7 +126,7 @@ class optional {
* Returns the value.
* Returns the value.
*/
*/
T
&
operator
*
()
{
T
&
operator
*
()
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
m_value
;
return
m_value
;
}
}
...
@@ -134,7 +134,7 @@ class optional {
...
@@ -134,7 +134,7 @@ class optional {
* Returns the value.
* Returns the value.
*/
*/
const
T
&
operator
*
()
const
{
const
T
&
operator
*
()
const
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
m_value
;
return
m_value
;
}
}
...
@@ -142,7 +142,7 @@ class optional {
...
@@ -142,7 +142,7 @@ class optional {
* Returns the value.
* Returns the value.
*/
*/
const
T
*
operator
->
()
const
{
const
T
*
operator
->
()
const
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
&
m_value
;
return
&
m_value
;
}
}
...
@@ -150,7 +150,7 @@ class optional {
...
@@ -150,7 +150,7 @@ class optional {
* Returns the value.
* Returns the value.
*/
*/
T
*
operator
->
()
{
T
*
operator
->
()
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
&
m_value
;
return
&
m_value
;
}
}
...
@@ -158,7 +158,7 @@ class optional {
...
@@ -158,7 +158,7 @@ class optional {
* Returns the value.
* Returns the value.
*/
*/
T
&
get
()
{
T
&
get
()
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
m_value
;
return
m_value
;
}
}
...
@@ -166,7 +166,7 @@ class optional {
...
@@ -166,7 +166,7 @@ class optional {
* Returns the value.
* Returns the value.
*/
*/
const
T
&
get
()
const
{
const
T
&
get
()
const
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
m_value
;
return
m_value
;
}
}
...
@@ -186,7 +186,7 @@ class optional {
...
@@ -186,7 +186,7 @@ class optional {
}
}
template
<
class
V
>
template
<
class
V
>
void
cr
(
V
&&
value
)
{
void
cr
(
V
&&
value
)
{
CAF_
REQUIRE
(
!
valid
());
CAF_
ASSERT
(
!
valid
());
m_valid
=
true
;
m_valid
=
true
;
new
(
&
m_value
)
T
(
std
::
forward
<
V
>
(
value
));
new
(
&
m_value
)
T
(
std
::
forward
<
V
>
(
value
));
}
}
...
@@ -232,32 +232,32 @@ class optional<T&> {
...
@@ -232,32 +232,32 @@ class optional<T&> {
}
}
T
&
operator
*
()
{
T
&
operator
*
()
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
*
m_value
;
return
*
m_value
;
}
}
const
T
&
operator
*
()
const
{
const
T
&
operator
*
()
const
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
*
m_value
;
return
*
m_value
;
}
}
T
*
operator
->
()
{
T
*
operator
->
()
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
m_value
;
return
m_value
;
}
}
const
T
*
operator
->
()
const
{
const
T
*
operator
->
()
const
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
m_value
;
return
m_value
;
}
}
T
&
get
()
{
T
&
get
()
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
*
m_value
;
return
*
m_value
;
}
}
const
T
&
get
()
const
{
const
T
&
get
()
const
{
CAF_
REQUIRE
(
valid
());
CAF_
ASSERT
(
valid
());
return
*
m_value
;
return
*
m_value
;
}
}
...
...
libcaf_core/caf/scheduler/coordinator.hpp
View file @
23f6f248
...
@@ -86,7 +86,7 @@ class coordinator : public abstract_coordinator {
...
@@ -86,7 +86,7 @@ class coordinator : public abstract_coordinator {
}
}
resumable
::
resume_result
resume
(
execution_unit
*
ptr
,
size_t
)
override
{
resumable
::
resume_result
resume
(
execution_unit
*
ptr
,
size_t
)
override
{
CAF_LOG_DEBUG
(
"shutdown_helper::resume => shutdown worker"
);
CAF_LOG_DEBUG
(
"shutdown_helper::resume => shutdown worker"
);
CAF_
REQUIRE
(
ptr
!=
nullptr
);
CAF_
ASSERT
(
ptr
!=
nullptr
);
std
::
unique_lock
<
std
::
mutex
>
guard
(
mtx
);
std
::
unique_lock
<
std
::
mutex
>
guard
(
mtx
);
last_worker
=
ptr
;
last_worker
=
ptr
;
cv
.
notify_all
();
cv
.
notify_all
();
...
...
libcaf_core/caf/scheduler/profiled_coordinator.hpp
View file @
23f6f248
...
@@ -193,7 +193,7 @@ class profiled_coordinator : public coordinator<Policy> {
...
@@ -193,7 +193,7 @@ class profiled_coordinator : public coordinator<Policy> {
void
stop_measuring
(
size_t
worker
,
actor_id
job
)
{
void
stop_measuring
(
size_t
worker
,
actor_id
job
)
{
auto
m
=
measurement
::
take
();
auto
m
=
measurement
::
take
();
auto
&
w
=
m_worker_states
[
worker
];
auto
&
w
=
m_worker_states
[
worker
];
CAF_
REQUIRE
(
job
==
w
.
current
);
CAF_
ASSERT
(
job
==
w
.
current
);
auto
delta
=
m
-
w
.
job
;
auto
delta
=
m
-
w
.
job
;
// It's not possible that the wallclock timer is less than actual CPU time
// It's not possible that the wallclock timer is less than actual CPU time
// spent. Due to resolution mismatches of the C++ high-resolution clock and
// spent. Due to resolution mismatches of the C++ high-resolution clock and
...
...
libcaf_core/caf/scheduler/worker.hpp
View file @
23f6f248
...
@@ -51,7 +51,7 @@ class worker : public execution_unit {
...
@@ -51,7 +51,7 @@ class worker : public execution_unit {
}
}
void
start
()
{
void
start
()
{
CAF_
REQUIRE
(
m_this_thread
.
get_id
()
==
std
::
thread
::
id
{});
CAF_
ASSERT
(
m_this_thread
.
get_id
()
==
std
::
thread
::
id
{});
auto
this_worker
=
this
;
auto
this_worker
=
this
;
m_this_thread
=
std
::
thread
{[
this_worker
]
{
m_this_thread
=
std
::
thread
{[
this_worker
]
{
CAF_LOGF_TRACE
(
"id = "
<<
this_worker
->
id
());
CAF_LOGF_TRACE
(
"id = "
<<
this_worker
->
id
());
...
@@ -67,7 +67,7 @@ class worker : public execution_unit {
...
@@ -67,7 +67,7 @@ class worker : public execution_unit {
* source, i.e., from any other thread.
* source, i.e., from any other thread.
*/
*/
void
external_enqueue
(
job_ptr
job
)
{
void
external_enqueue
(
job_ptr
job
)
{
CAF_
REQUIRE
(
job
!=
nullptr
);
CAF_
ASSERT
(
job
!=
nullptr
);
CAF_LOG_TRACE
(
"id = "
<<
id
()
<<
" actor id "
<<
id_of
(
job
));
CAF_LOG_TRACE
(
"id = "
<<
id
()
<<
" actor id "
<<
id_of
(
job
));
m_policy
.
external_enqueue
(
this
,
job
);
m_policy
.
external_enqueue
(
this
,
job
);
}
}
...
@@ -78,7 +78,7 @@ class worker : public execution_unit {
...
@@ -78,7 +78,7 @@ class worker : public execution_unit {
* @warning Must not be called from other threads.
* @warning Must not be called from other threads.
*/
*/
void
exec_later
(
job_ptr
job
)
override
{
void
exec_later
(
job_ptr
job
)
override
{
CAF_
REQUIRE
(
job
!=
nullptr
);
CAF_
ASSERT
(
job
!=
nullptr
);
CAF_LOG_TRACE
(
"id = "
<<
id
()
<<
" actor id "
<<
id_of
(
job
));
CAF_LOG_TRACE
(
"id = "
<<
id
()
<<
" actor id "
<<
id_of
(
job
));
m_policy
.
internal_enqueue
(
this
,
job
);
m_policy
.
internal_enqueue
(
this
,
job
);
}
}
...
@@ -122,7 +122,7 @@ class worker : public execution_unit {
...
@@ -122,7 +122,7 @@ class worker : public execution_unit {
// scheduling loop
// scheduling loop
for
(;;)
{
for
(;;)
{
auto
job
=
m_policy
.
dequeue
(
this
);
auto
job
=
m_policy
.
dequeue
(
this
);
CAF_
REQUIRE
(
job
!=
nullptr
);
CAF_
ASSERT
(
job
!=
nullptr
);
CAF_LOG_DEBUG
(
"resume actor "
<<
id_of
(
job
));
CAF_LOG_DEBUG
(
"resume actor "
<<
id_of
(
job
));
CAF_PUSH_AID_FROM_PTR
(
dynamic_cast
<
abstract_actor
*>
(
job
));
CAF_PUSH_AID_FROM_PTR
(
dynamic_cast
<
abstract_actor
*>
(
job
));
m_policy
.
before_resume
(
this
,
job
);
m_policy
.
before_resume
(
this
,
job
);
...
...
libcaf_core/caf/string_algorithms.hpp
View file @
23f6f248
...
@@ -85,7 +85,7 @@ void replace_all(std::string& str,
...
@@ -85,7 +85,7 @@ void replace_all(std::string& str,
auto
i
=
next
(
std
::
begin
(
str
));
auto
i
=
next
(
std
::
begin
(
str
));
while
(
i
!=
std
::
end
(
str
))
{
while
(
i
!=
std
::
end
(
str
))
{
auto
before
=
std
::
distance
(
std
::
begin
(
str
),
i
);
auto
before
=
std
::
distance
(
std
::
begin
(
str
),
i
);
CAF_
REQUIRE
(
before
>=
0
);
CAF_
ASSERT
(
before
>=
0
);
str
.
replace
(
i
,
i
+
WhatSize
-
1
,
with
);
str
.
replace
(
i
,
i
+
WhatSize
-
1
,
with
);
// i became invalidated -> use new iterator pointing
// i became invalidated -> use new iterator pointing
// to the first character after the replaced text
// to the first character after the replaced text
...
...
libcaf_core/caf/uniform_type_info.hpp
View file @
23f6f248
...
@@ -263,7 +263,7 @@ class uniform_type_info {
...
@@ -263,7 +263,7 @@ class uniform_type_info {
template
<
class
T
>
template
<
class
T
>
uniform_value
create_impl
(
const
uniform_value
&
other
)
const
{
uniform_value
create_impl
(
const
uniform_value
&
other
)
const
{
if
(
other
)
{
if
(
other
)
{
CAF_
REQUIRE
(
other
->
ti
==
this
);
CAF_
ASSERT
(
other
->
ti
==
this
);
auto
ptr
=
reinterpret_cast
<
const
T
*>
(
other
->
val
);
auto
ptr
=
reinterpret_cast
<
const
T
*>
(
other
->
val
);
return
make_uniform_value
<
T
>
(
this
,
*
ptr
);
return
make_uniform_value
<
T
>
(
this
,
*
ptr
);
}
}
...
...
libcaf_core/src/abstract_actor.cpp
View file @
23f6f248
...
@@ -132,7 +132,7 @@ bool abstract_actor::link_impl(linking_operation op, const actor_addr& other) {
...
@@ -132,7 +132,7 @@ bool abstract_actor::link_impl(linking_operation op, const actor_addr& other) {
case
remove_link_op
:
case
remove_link_op
:
return
remove_link_impl
(
other
);
return
remove_link_impl
(
other
);
default:
default:
CAF_
REQUIRE
(
op
==
remove_backlink_op
);
CAF_
ASSERT
(
op
==
remove_backlink_op
);
return
remove_backlink_impl
(
other
);
return
remove_backlink_impl
(
other
);
}
}
}
}
...
@@ -214,7 +214,7 @@ actor_addr abstract_actor::address() const {
...
@@ -214,7 +214,7 @@ actor_addr abstract_actor::address() const {
void
abstract_actor
::
cleanup
(
uint32_t
reason
)
{
void
abstract_actor
::
cleanup
(
uint32_t
reason
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
reason
));
CAF_LOG_TRACE
(
CAF_ARG
(
reason
));
CAF_
REQUIRE
(
reason
!=
exit_reason
::
not_exited
);
CAF_
ASSERT
(
reason
!=
exit_reason
::
not_exited
);
// move everyhting out of the critical section before processing it
// move everyhting out of the critical section before processing it
attachable_ptr
head
;
attachable_ptr
head
;
{
// lifetime scope of guard
{
// lifetime scope of guard
...
...
libcaf_core/src/actor_namespace.cpp
View file @
23f6f248
...
@@ -41,7 +41,7 @@ actor_namespace::actor_namespace(backend& be) : m_backend(be) {
...
@@ -41,7 +41,7 @@ actor_namespace::actor_namespace(backend& be) : m_backend(be) {
}
}
void
actor_namespace
::
write
(
serializer
*
sink
,
const
actor_addr
&
addr
)
{
void
actor_namespace
::
write
(
serializer
*
sink
,
const
actor_addr
&
addr
)
{
CAF_
REQUIRE
(
sink
!=
nullptr
);
CAF_
ASSERT
(
sink
!=
nullptr
);
if
(
!
addr
)
{
if
(
!
addr
)
{
node_id
::
host_id_type
zero
;
node_id
::
host_id_type
zero
;
std
::
fill
(
zero
.
begin
(),
zero
.
end
(),
0
);
std
::
fill
(
zero
.
begin
(),
zero
.
end
(),
0
);
...
@@ -62,7 +62,7 @@ void actor_namespace::write(serializer* sink, const actor_addr& addr) {
...
@@ -62,7 +62,7 @@ void actor_namespace::write(serializer* sink, const actor_addr& addr) {
}
}
actor_addr
actor_namespace
::
read
(
deserializer
*
source
)
{
actor_addr
actor_namespace
::
read
(
deserializer
*
source
)
{
CAF_
REQUIRE
(
source
!=
nullptr
);
CAF_
ASSERT
(
source
!=
nullptr
);
node_id
::
host_id_type
hid
;
node_id
::
host_id_type
hid
;
auto
aid
=
source
->
read
<
uint32_t
>
();
// actor id
auto
aid
=
source
->
read
<
uint32_t
>
();
// actor id
source
->
read_raw
(
node_id
::
host_id_size
,
hid
.
data
());
// host id
source
->
read_raw
(
node_id
::
host_id_size
,
hid
.
data
());
// host id
...
...
libcaf_core/src/actor_pool.cpp
View file @
23f6f248
...
@@ -37,7 +37,7 @@ actor_pool::round_robin::round_robin(const round_robin&) : m_pos(0) {
...
@@ -37,7 +37,7 @@ actor_pool::round_robin::round_robin(const round_robin&) : m_pos(0) {
void
actor_pool
::
round_robin
::
operator
()(
uplock
&
guard
,
const
actor_vec
&
vec
,
void
actor_pool
::
round_robin
::
operator
()(
uplock
&
guard
,
const
actor_vec
&
vec
,
mailbox_element_ptr
&
ptr
,
mailbox_element_ptr
&
ptr
,
execution_unit
*
host
)
{
execution_unit
*
host
)
{
CAF_
REQUIRE
(
!
vec
.
empty
());
CAF_
ASSERT
(
!
vec
.
empty
());
actor
selected
=
vec
[
m_pos
++
%
vec
.
size
()];
actor
selected
=
vec
[
m_pos
++
%
vec
.
size
()];
guard
.
unlock
();
guard
.
unlock
();
selected
->
enqueue
(
std
::
move
(
ptr
),
host
);
selected
->
enqueue
(
std
::
move
(
ptr
),
host
);
...
@@ -46,7 +46,7 @@ void actor_pool::round_robin::operator()(uplock& guard, const actor_vec& vec,
...
@@ -46,7 +46,7 @@ void actor_pool::round_robin::operator()(uplock& guard, const actor_vec& vec,
void
actor_pool
::
broadcast
::
operator
()(
uplock
&
,
const
actor_vec
&
vec
,
void
actor_pool
::
broadcast
::
operator
()(
uplock
&
,
const
actor_vec
&
vec
,
mailbox_element_ptr
&
ptr
,
mailbox_element_ptr
&
ptr
,
execution_unit
*
host
)
{
execution_unit
*
host
)
{
CAF_
REQUIRE
(
!
vec
.
empty
());
CAF_
ASSERT
(
!
vec
.
empty
());
for
(
size_t
i
=
1
;
i
<
vec
.
size
();
++
i
)
{
for
(
size_t
i
=
1
;
i
<
vec
.
size
();
++
i
)
{
vec
[
i
]
->
enqueue
(
ptr
->
sender
,
ptr
->
mid
,
ptr
->
msg
,
host
);
vec
[
i
]
->
enqueue
(
ptr
->
sender
,
ptr
->
mid
,
ptr
->
msg
,
host
);
}
}
...
...
libcaf_core/src/actor_registry.cpp
View file @
23f6f248
...
@@ -112,7 +112,7 @@ void actor_registry::dec_running() {
...
@@ -112,7 +112,7 @@ void actor_registry::dec_running() {
}
}
void
actor_registry
::
await_running_count_equal
(
size_t
expected
)
{
void
actor_registry
::
await_running_count_equal
(
size_t
expected
)
{
CAF_
REQUIRE
(
expected
==
0
||
expected
==
1
);
CAF_
ASSERT
(
expected
==
0
||
expected
==
1
);
CAF_LOG_TRACE
(
CAF_ARG
(
expected
));
CAF_LOG_TRACE
(
CAF_ARG
(
expected
));
std
::
unique_lock
<
std
::
mutex
>
guard
{
m_running_mtx
};
std
::
unique_lock
<
std
::
mutex
>
guard
{
m_running_mtx
};
while
(
m_running
!=
expected
)
{
while
(
m_running
!=
expected
)
{
...
...
libcaf_core/src/behavior_impl.cpp
View file @
23f6f248
...
@@ -91,7 +91,7 @@ void behavior_impl::handle_timeout() {
...
@@ -91,7 +91,7 @@ void behavior_impl::handle_timeout() {
}
}
behavior_impl
::
pointer
behavior_impl
::
or_else
(
const
pointer
&
other
)
{
behavior_impl
::
pointer
behavior_impl
::
or_else
(
const
pointer
&
other
)
{
CAF_
REQUIRE
(
other
!=
nullptr
);
CAF_
ASSERT
(
other
!=
nullptr
);
return
make_counted
<
combinator
>
(
this
,
other
);
return
make_counted
<
combinator
>
(
this
,
other
);
}
}
...
...
libcaf_core/src/concatenated_tuple.cpp
View file @
23f6f248
...
@@ -45,7 +45,7 @@ auto concatenated_tuple::make(std::initializer_list<cow_ptr> xs) -> cow_ptr {
...
@@ -45,7 +45,7 @@ auto concatenated_tuple::make(std::initializer_list<cow_ptr> xs) -> cow_ptr {
}
}
void
*
concatenated_tuple
::
mutable_at
(
size_t
pos
)
{
void
*
concatenated_tuple
::
mutable_at
(
size_t
pos
)
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
auto
selected
=
select
(
pos
);
auto
selected
=
select
(
pos
);
return
selected
.
first
->
mutable_at
(
selected
.
second
);
return
selected
.
first
->
mutable_at
(
selected
.
second
);
}
}
...
@@ -59,7 +59,7 @@ message_data::cow_ptr concatenated_tuple::copy() const {
...
@@ -59,7 +59,7 @@ message_data::cow_ptr concatenated_tuple::copy() const {
}
}
const
void
*
concatenated_tuple
::
at
(
size_t
pos
)
const
{
const
void
*
concatenated_tuple
::
at
(
size_t
pos
)
const
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
auto
selected
=
select
(
pos
);
auto
selected
=
select
(
pos
);
return
selected
.
first
->
at
(
selected
.
second
);
return
selected
.
first
->
at
(
selected
.
second
);
}
}
...
@@ -75,13 +75,13 @@ uint32_t concatenated_tuple::type_token() const {
...
@@ -75,13 +75,13 @@ uint32_t concatenated_tuple::type_token() const {
}
}
const
char
*
concatenated_tuple
::
uniform_name_at
(
size_t
pos
)
const
{
const
char
*
concatenated_tuple
::
uniform_name_at
(
size_t
pos
)
const
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
auto
selected
=
select
(
pos
);
auto
selected
=
select
(
pos
);
return
selected
.
first
->
uniform_name_at
(
selected
.
second
);
return
selected
.
first
->
uniform_name_at
(
selected
.
second
);
}
}
uint16_t
concatenated_tuple
::
type_nr_at
(
size_t
pos
)
const
{
uint16_t
concatenated_tuple
::
type_nr_at
(
size_t
pos
)
const
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
auto
selected
=
select
(
pos
);
auto
selected
=
select
(
pos
);
return
selected
.
first
->
type_nr_at
(
selected
.
second
);
return
selected
.
first
->
type_nr_at
(
selected
.
second
);
}
}
...
...
libcaf_core/src/decorated_tuple.cpp
View file @
23f6f248
...
@@ -37,7 +37,7 @@ decorated_tuple::cow_ptr decorated_tuple::make(cow_ptr d, vector_type v) {
...
@@ -37,7 +37,7 @@ decorated_tuple::cow_ptr decorated_tuple::make(cow_ptr d, vector_type v) {
}
}
void
*
decorated_tuple
::
mutable_at
(
size_t
pos
)
{
void
*
decorated_tuple
::
mutable_at
(
size_t
pos
)
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
return
m_decorated
->
mutable_at
(
m_mapping
[
pos
]);
return
m_decorated
->
mutable_at
(
m_mapping
[
pos
]);
}
}
...
@@ -50,7 +50,7 @@ message_data::cow_ptr decorated_tuple::copy() const {
...
@@ -50,7 +50,7 @@ message_data::cow_ptr decorated_tuple::copy() const {
}
}
const
void
*
decorated_tuple
::
at
(
size_t
pos
)
const
{
const
void
*
decorated_tuple
::
at
(
size_t
pos
)
const
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
return
m_decorated
->
at
(
m_mapping
[
pos
]);
return
m_decorated
->
at
(
m_mapping
[
pos
]);
}
}
...
@@ -75,7 +75,7 @@ decorated_tuple::decorated_tuple(cow_ptr&& d, vector_type&& v)
...
@@ -75,7 +75,7 @@ decorated_tuple::decorated_tuple(cow_ptr&& d, vector_type&& v)
:
m_decorated
(
std
::
move
(
d
)),
:
m_decorated
(
std
::
move
(
d
)),
m_mapping
(
std
::
move
(
v
)),
m_mapping
(
std
::
move
(
v
)),
m_type_token
(
0xFFFFFFFF
)
{
m_type_token
(
0xFFFFFFFF
)
{
CAF_
REQUIRE
(
m_mapping
.
empty
()
CAF_
ASSERT
(
m_mapping
.
empty
()
||
*
(
std
::
max_element
(
m_mapping
.
begin
(),
m_mapping
.
end
()))
||
*
(
std
::
max_element
(
m_mapping
.
begin
(),
m_mapping
.
end
()))
<
static_cast
<
const
cow_ptr
&>
(
m_decorated
)
->
size
());
<
static_cast
<
const
cow_ptr
&>
(
m_decorated
)
->
size
());
// calculate type token
// calculate type token
...
...
libcaf_core/src/default_attachable.cpp
View file @
23f6f248
...
@@ -35,7 +35,7 @@ message make(abstract_actor* self, uint32_t reason) {
...
@@ -35,7 +35,7 @@ message make(abstract_actor* self, uint32_t reason) {
}
// namespace <anonymous>
}
// namespace <anonymous>
void
default_attachable
::
actor_exited
(
abstract_actor
*
self
,
uint32_t
reason
)
{
void
default_attachable
::
actor_exited
(
abstract_actor
*
self
,
uint32_t
reason
)
{
CAF_
REQUIRE
(
self
->
address
()
!=
m_observer
);
CAF_
ASSERT
(
self
->
address
()
!=
m_observer
);
auto
factory
=
m_type
==
monitor
?
&
make
<
down_msg
>
:
&
make
<
exit_msg
>
;
auto
factory
=
m_type
==
monitor
?
&
make
<
down_msg
>
:
&
make
<
exit_msg
>
;
auto
ptr
=
actor_cast
<
abstract_actor_ptr
>
(
m_observer
);
auto
ptr
=
actor_cast
<
abstract_actor_ptr
>
(
m_observer
);
ptr
->
enqueue
(
self
->
address
(),
message_id
{}.
with_high_priority
(),
ptr
->
enqueue
(
self
->
address
(),
message_id
{}.
with_high_priority
(),
...
...
libcaf_core/src/forwarding_actor_proxy.cpp
View file @
23f6f248
...
@@ -33,7 +33,7 @@ forwarding_actor_proxy::forwarding_actor_proxy(actor_id aid, node_id nid,
...
@@ -33,7 +33,7 @@ forwarding_actor_proxy::forwarding_actor_proxy(actor_id aid, node_id nid,
actor
mgr
)
actor
mgr
)
:
actor_proxy
(
aid
,
nid
),
:
actor_proxy
(
aid
,
nid
),
m_manager
(
mgr
)
{
m_manager
(
mgr
)
{
CAF_
REQUIRE
(
mgr
!=
invalid_actor
);
CAF_
ASSERT
(
mgr
!=
invalid_actor
);
CAF_LOG_INFO
(
CAF_ARG
(
aid
)
<<
", "
<<
CAF_TARG
(
nid
,
to_string
));
CAF_LOG_INFO
(
CAF_ARG
(
aid
)
<<
", "
<<
CAF_TARG
(
nid
,
to_string
));
}
}
...
...
libcaf_core/src/group_manager.cpp
View file @
23f6f248
...
@@ -228,8 +228,8 @@ class local_group_proxy : public local_group {
...
@@ -228,8 +228,8 @@ class local_group_proxy : public local_group {
template
<
class
...
Ts
>
template
<
class
...
Ts
>
local_group_proxy
(
actor
remote_broker
,
Ts
&&
...
xs
)
local_group_proxy
(
actor
remote_broker
,
Ts
&&
...
xs
)
:
super
(
false
,
std
::
forward
<
Ts
>
(
xs
)...)
{
:
super
(
false
,
std
::
forward
<
Ts
>
(
xs
)...)
{
CAF_
REQUIRE
(
m_broker
==
invalid_actor
);
CAF_
ASSERT
(
m_broker
==
invalid_actor
);
CAF_
REQUIRE
(
remote_broker
!=
invalid_actor
);
CAF_
ASSERT
(
remote_broker
!=
invalid_actor
);
m_broker
=
std
::
move
(
remote_broker
);
m_broker
=
std
::
move
(
remote_broker
);
m_proxy_broker
=
spawn
<
proxy_broker
,
hidden
>
(
this
);
m_proxy_broker
=
spawn
<
proxy_broker
,
hidden
>
(
this
);
}
}
...
@@ -357,7 +357,7 @@ class local_group_module : public abstract_group::module {
...
@@ -357,7 +357,7 @@ class local_group_module : public abstract_group::module {
void
serialize
(
local_group
*
ptr
,
serializer
*
sink
)
{
void
serialize
(
local_group
*
ptr
,
serializer
*
sink
)
{
// serialize identifier & broker
// serialize identifier & broker
sink
->
write_value
(
ptr
->
identifier
());
sink
->
write_value
(
ptr
->
identifier
());
CAF_
REQUIRE
(
ptr
->
broker
()
!=
invalid_actor
);
CAF_
ASSERT
(
ptr
->
broker
()
!=
invalid_actor
);
m_actor_utype
->
serialize
(
&
ptr
->
broker
(),
sink
);
m_actor_utype
->
serialize
(
&
ptr
->
broker
(),
sink
);
}
}
...
...
libcaf_core/src/local_actor.cpp
View file @
23f6f248
...
@@ -159,14 +159,14 @@ void local_actor::handle_timeout(behavior& bhvr, uint32_t timeout_id) {
...
@@ -159,14 +159,14 @@ void local_actor::handle_timeout(behavior& bhvr, uint32_t timeout_id) {
}
}
// auto-remove behavior for blocking actors
// auto-remove behavior for blocking actors
if
(
is_blocking
())
{
if
(
is_blocking
())
{
CAF_
REQUIRE
(
m_bhvr_stack
.
back
()
==
bhvr
);
CAF_
ASSERT
(
m_bhvr_stack
.
back
()
==
bhvr
);
m_bhvr_stack
.
pop_back
();
m_bhvr_stack
.
pop_back
();
return
;
return
;
}
}
// request next timeout for non-blocking (i.e. event-based) actors
// request next timeout for non-blocking (i.e. event-based) actors
// if behavior stack was not modified by calling become()/unbecome()
// if behavior stack was not modified by calling become()/unbecome()
if
(
m_bhvr_stack
.
back
()
==
bhvr
)
{
if
(
m_bhvr_stack
.
back
()
==
bhvr
)
{
CAF_
REQUIRE
(
bhvr
.
timeout
().
valid
());
CAF_
ASSERT
(
bhvr
.
timeout
().
valid
());
request_timeout
(
bhvr
.
timeout
());
request_timeout
(
bhvr
.
timeout
());
}
}
}
}
...
@@ -208,7 +208,7 @@ msg_type filter_msg(local_actor* self, mailbox_element& node) {
...
@@ -208,7 +208,7 @@ msg_type filter_msg(local_actor* self, mailbox_element& node) {
if
(
msg
.
match_element
<
timeout_msg
>
(
0
))
{
if
(
msg
.
match_element
<
timeout_msg
>
(
0
))
{
auto
&
tm
=
msg
.
get_as
<
timeout_msg
>
(
0
);
auto
&
tm
=
msg
.
get_as
<
timeout_msg
>
(
0
);
auto
tid
=
tm
.
timeout_id
;
auto
tid
=
tm
.
timeout_id
;
CAF_
REQUIRE
(
!
mid
.
valid
());
CAF_
ASSERT
(
!
mid
.
valid
());
if
(
self
->
is_active_timeout
(
tid
))
{
if
(
self
->
is_active_timeout
(
tid
))
{
return
msg_type
::
timeout
;
return
msg_type
::
timeout
;
}
}
...
@@ -216,7 +216,7 @@ msg_type filter_msg(local_actor* self, mailbox_element& node) {
...
@@ -216,7 +216,7 @@ msg_type filter_msg(local_actor* self, mailbox_element& node) {
}
}
if
(
msg
.
match_element
<
exit_msg
>
(
0
))
{
if
(
msg
.
match_element
<
exit_msg
>
(
0
))
{
auto
&
em
=
msg
.
get_as
<
exit_msg
>
(
0
);
auto
&
em
=
msg
.
get_as
<
exit_msg
>
(
0
);
CAF_
REQUIRE
(
!
mid
.
valid
());
CAF_
ASSERT
(
!
mid
.
valid
());
// make sure to get rid of attachables if they're no longer needed
// make sure to get rid of attachables if they're no longer needed
self
->
unlink_from
(
em
.
source
);
self
->
unlink_from
(
em
.
source
);
if
(
self
->
trap_exit
()
==
false
)
{
if
(
self
->
trap_exit
()
==
false
)
{
...
@@ -314,7 +314,7 @@ optional<message> post_process_invoke_res(local_actor* self,
...
@@ -314,7 +314,7 @@ optional<message> post_process_invoke_res(local_actor* self,
invoke_message_result
local_actor
::
invoke_message
(
mailbox_element_ptr
&
ptr
,
invoke_message_result
local_actor
::
invoke_message
(
mailbox_element_ptr
&
ptr
,
behavior
&
fun
,
behavior
&
fun
,
message_id
awaited_id
)
{
message_id
awaited_id
)
{
CAF_
REQUIRE
(
ptr
!=
nullptr
);
CAF_
ASSERT
(
ptr
!=
nullptr
);
CAF_LOG_TRACE
(
CAF_TSARG
(
*
ptr
)
<<
", "
<<
CAF_MARG
(
awaited_id
,
integer_value
));
CAF_LOG_TRACE
(
CAF_TSARG
(
*
ptr
)
<<
", "
<<
CAF_MARG
(
awaited_id
,
integer_value
));
switch
(
filter_msg
(
this
,
*
ptr
))
{
switch
(
filter_msg
(
this
,
*
ptr
))
{
case
msg_type
:
:
normal_exit
:
case
msg_type
:
:
normal_exit
:
...
@@ -409,7 +409,7 @@ message_id local_actor::new_request_id(message_priority mp) {
...
@@ -409,7 +409,7 @@ message_id local_actor::new_request_id(message_priority mp) {
}
}
void
local_actor
::
mark_arrived
(
message_id
mid
)
{
void
local_actor
::
mark_arrived
(
message_id
mid
)
{
CAF_
REQUIRE
(
mid
.
is_response
());
CAF_
ASSERT
(
mid
.
is_response
());
pending_response_predicate
predicate
{
mid
};
pending_response_predicate
predicate
{
mid
};
m_pending_responses
.
remove_if
(
predicate
);
m_pending_responses
.
remove_if
(
predicate
);
}
}
...
@@ -419,7 +419,7 @@ bool local_actor::awaits_response() const {
...
@@ -419,7 +419,7 @@ bool local_actor::awaits_response() const {
}
}
bool
local_actor
::
awaits
(
message_id
mid
)
const
{
bool
local_actor
::
awaits
(
message_id
mid
)
const
{
CAF_
REQUIRE
(
mid
.
is_response
());
CAF_
ASSERT
(
mid
.
is_response
());
pending_response_predicate
predicate
{
mid
};
pending_response_predicate
predicate
{
mid
};
return
std
::
any_of
(
m_pending_responses
.
begin
(),
m_pending_responses
.
end
(),
return
std
::
any_of
(
m_pending_responses
.
begin
(),
m_pending_responses
.
end
(),
predicate
);
predicate
);
...
@@ -468,7 +468,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
...
@@ -468,7 +468,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
while
(
resume
(
nullptr
,
max_throughput
)
!=
resumable
::
done
)
{
while
(
resume
(
nullptr
,
max_throughput
)
!=
resumable
::
done
)
{
// await new data before resuming actor
// await new data before resuming actor
await_data
();
await_data
();
CAF_
REQUIRE
(
mailbox
().
blocked
()
==
false
);
CAF_
ASSERT
(
mailbox
().
blocked
()
==
false
);
}
}
detach_from_scheduler
();
detach_from_scheduler
();
}).
detach
();
}).
detach
();
...
@@ -547,7 +547,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
...
@@ -547,7 +547,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
if
(
is_blocking
())
{
if
(
is_blocking
())
{
// actor lives in its own thread
// actor lives in its own thread
CAF_
REQUIRE
(
dynamic_cast
<
blocking_actor
*>
(
this
)
!=
0
);
CAF_
ASSERT
(
dynamic_cast
<
blocking_actor
*>
(
this
)
!=
0
);
auto
self
=
static_cast
<
blocking_actor
*>
(
this
);
auto
self
=
static_cast
<
blocking_actor
*>
(
this
);
uint32_t
rsn
=
exit_reason
::
normal
;
uint32_t
rsn
=
exit_reason
::
normal
;
std
::
exception_ptr
eptr
=
nullptr
;
std
::
exception_ptr
eptr
=
nullptr
;
...
@@ -605,7 +605,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
...
@@ -605,7 +605,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
};
};
// actors without behavior or that have already defined
// actors without behavior or that have already defined
// an exit reason must not be resumed
// an exit reason must not be resumed
CAF_
REQUIRE
(
!
is_initialized
()
CAF_
ASSERT
(
!
is_initialized
()
||
(
has_behavior
()
||
(
has_behavior
()
&&
planned_exit_reason
()
==
exit_reason
::
not_exited
));
&&
planned_exit_reason
()
==
exit_reason
::
not_exited
));
std
::
exception_ptr
eptr
=
nullptr
;
std
::
exception_ptr
eptr
=
nullptr
;
...
@@ -654,7 +654,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
...
@@ -654,7 +654,7 @@ resumable::resume_result local_actor::resume(execution_unit* eu,
}
}
break
;
break
;
case
im_skipped
:
case
im_skipped
:
CAF_
REQUIRE
(
ptr
!=
nullptr
);
CAF_
ASSERT
(
ptr
!=
nullptr
);
push_to_cache
(
std
::
move
(
ptr
));
push_to_cache
(
std
::
move
(
ptr
));
break
;
break
;
case
im_dropped
:
case
im_dropped
:
...
...
libcaf_core/src/logging.cpp
View file @
23f6f248
...
@@ -103,7 +103,7 @@ class logging_impl : public logging {
...
@@ -103,7 +103,7 @@ class logging_impl : public logging {
m_queue
.
synchronized_await
(
m_queue_mtx
,
m_queue_cv
);
m_queue
.
synchronized_await
(
m_queue_mtx
,
m_queue_cv
);
// read & process event
// read & process event
event
.
reset
(
m_queue
.
try_pop
());
event
.
reset
(
m_queue
.
try_pop
());
CAF_
REQUIRE
(
event
!=
nullptr
);
CAF_
ASSERT
(
event
!=
nullptr
);
if
(
event
->
msg
.
empty
())
{
if
(
event
->
msg
.
empty
())
{
out
.
close
();
out
.
close
();
return
;
return
;
...
...
libcaf_core/src/message.cpp
View file @
23f6f248
...
@@ -52,12 +52,12 @@ void message::swap(message& other) {
...
@@ -52,12 +52,12 @@ void message::swap(message& other) {
}
}
void
*
message
::
mutable_at
(
size_t
p
)
{
void
*
message
::
mutable_at
(
size_t
p
)
{
CAF_
REQUIRE
(
m_vals
);
CAF_
ASSERT
(
m_vals
);
return
m_vals
->
mutable_at
(
p
);
return
m_vals
->
mutable_at
(
p
);
}
}
const
void
*
message
::
at
(
size_t
p
)
const
{
const
void
*
message
::
at
(
size_t
p
)
const
{
CAF_
REQUIRE
(
m_vals
);
CAF_
ASSERT
(
m_vals
);
return
m_vals
->
at
(
p
);
return
m_vals
->
at
(
p
);
}
}
...
@@ -71,12 +71,12 @@ const char* message::uniform_name_at(size_t pos) const {
...
@@ -71,12 +71,12 @@ const char* message::uniform_name_at(size_t pos) const {
}
}
bool
message
::
equals
(
const
message
&
other
)
const
{
bool
message
::
equals
(
const
message
&
other
)
const
{
CAF_
REQUIRE
(
m_vals
);
CAF_
ASSERT
(
m_vals
);
return
m_vals
->
equals
(
*
other
.
vals
());
return
m_vals
->
equals
(
*
other
.
vals
());
}
}
message
message
::
drop
(
size_t
n
)
const
{
message
message
::
drop
(
size_t
n
)
const
{
CAF_
REQUIRE
(
m_vals
);
CAF_
ASSERT
(
m_vals
);
if
(
n
==
0
)
{
if
(
n
==
0
)
{
return
*
this
;
return
*
this
;
}
}
...
@@ -90,7 +90,7 @@ message message::drop(size_t n) const {
...
@@ -90,7 +90,7 @@ message message::drop(size_t n) const {
}
}
message
message
::
drop_right
(
size_t
n
)
const
{
message
message
::
drop_right
(
size_t
n
)
const
{
CAF_
REQUIRE
(
m_vals
);
CAF_
ASSERT
(
m_vals
);
if
(
n
==
0
)
{
if
(
n
==
0
)
{
return
*
this
;
return
*
this
;
}
}
...
...
libcaf_core/src/message_builder.cpp
View file @
23f6f248
...
@@ -53,12 +53,12 @@ class message_builder::dynamic_msg_data : public detail::message_data {
...
@@ -53,12 +53,12 @@ class message_builder::dynamic_msg_data : public detail::message_data {
~
dynamic_msg_data
();
~
dynamic_msg_data
();
const
void
*
at
(
size_t
pos
)
const
override
{
const
void
*
at
(
size_t
pos
)
const
override
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
return
m_elements
[
pos
]
->
val
;
return
m_elements
[
pos
]
->
val
;
}
}
void
*
mutable_at
(
size_t
pos
)
override
{
void
*
mutable_at
(
size_t
pos
)
override
{
CAF_
REQUIRE
(
pos
<
size
());
CAF_
ASSERT
(
pos
<
size
());
return
m_elements
[
pos
]
->
val
;
return
m_elements
[
pos
]
->
val
;
}
}
...
@@ -72,7 +72,7 @@ class message_builder::dynamic_msg_data : public detail::message_data {
...
@@ -72,7 +72,7 @@ class message_builder::dynamic_msg_data : public detail::message_data {
bool
match_element
(
size_t
pos
,
uint16_t
typenr
,
bool
match_element
(
size_t
pos
,
uint16_t
typenr
,
const
std
::
type_info
*
rtti
)
const
override
{
const
std
::
type_info
*
rtti
)
const
override
{
CAF_
REQUIRE
(
typenr
!=
0
||
rtti
!=
nullptr
);
CAF_
ASSERT
(
typenr
!=
0
||
rtti
!=
nullptr
);
auto
uti
=
m_elements
[
pos
]
->
ti
;
auto
uti
=
m_elements
[
pos
]
->
ti
;
if
(
uti
->
type_nr
()
!=
typenr
)
{
if
(
uti
->
type_nr
()
!=
typenr
)
{
return
false
;
return
false
;
...
...
libcaf_core/src/response_promise.cpp
View file @
23f6f248
...
@@ -27,7 +27,7 @@ namespace caf {
...
@@ -27,7 +27,7 @@ namespace caf {
response_promise
::
response_promise
(
const
actor_addr
&
from
,
const
actor_addr
&
to
,
response_promise
::
response_promise
(
const
actor_addr
&
from
,
const
actor_addr
&
to
,
const
message_id
&
id
)
const
message_id
&
id
)
:
m_from
(
from
),
m_to
(
to
),
m_id
(
id
)
{
:
m_from
(
from
),
m_to
(
to
),
m_id
(
id
)
{
CAF_
REQUIRE
(
id
.
is_response
()
||
!
id
.
valid
());
CAF_
ASSERT
(
id
.
is_response
()
||
!
id
.
valid
());
}
}
void
response_promise
::
deliver
(
message
msg
)
const
{
void
response_promise
::
deliver
(
message
msg
)
const
{
...
...
libcaf_core/src/singletons.cpp
View file @
23f6f248
...
@@ -131,7 +131,7 @@ logging* singletons::get_logger() {
...
@@ -131,7 +131,7 @@ logging* singletons::get_logger() {
}
}
std
::
atomic
<
abstract_singleton
*>&
singletons
::
get_plugin_singleton
(
size_t
id
)
{
std
::
atomic
<
abstract_singleton
*>&
singletons
::
get_plugin_singleton
(
size_t
id
)
{
CAF_
REQUIRE
(
id
<
max_plugins
);
CAF_
ASSERT
(
id
<
max_plugins
);
return
s_plugins
[
id
];
return
s_plugins
[
id
];
}
}
...
...
libcaf_core/src/sync_request_bouncer.cpp
View file @
23f6f248
...
@@ -37,7 +37,7 @@ sync_request_bouncer::sync_request_bouncer(uint32_t r)
...
@@ -37,7 +37,7 @@ sync_request_bouncer::sync_request_bouncer(uint32_t r)
void
sync_request_bouncer
::
operator
()(
const
actor_addr
&
sender
,
void
sync_request_bouncer
::
operator
()(
const
actor_addr
&
sender
,
const
message_id
&
mid
)
const
{
const
message_id
&
mid
)
const
{
CAF_
REQUIRE
(
rsn
!=
exit_reason
::
not_exited
);
CAF_
ASSERT
(
rsn
!=
exit_reason
::
not_exited
);
if
(
sender
&&
mid
.
is_request
())
{
if
(
sender
&&
mid
.
is_request
())
{
auto
ptr
=
actor_cast
<
abstract_actor_ptr
>
(
sender
);
auto
ptr
=
actor_cast
<
abstract_actor_ptr
>
(
sender
);
ptr
->
enqueue
(
invalid_actor_addr
,
mid
.
response_id
(),
ptr
->
enqueue
(
invalid_actor_addr
,
mid
.
response_id
(),
...
...
libcaf_core/src/try_match.cpp
View file @
23f6f248
...
@@ -30,7 +30,7 @@ bool is_wildcard(const meta_element& me) {
...
@@ -30,7 +30,7 @@ bool is_wildcard(const meta_element& me) {
bool
match_element
(
const
meta_element
&
me
,
const
message
&
msg
,
bool
match_element
(
const
meta_element
&
me
,
const
message
&
msg
,
size_t
pos
,
void
**
storage
)
{
size_t
pos
,
void
**
storage
)
{
CAF_
REQUIRE
(
me
.
typenr
!=
0
||
me
.
type
!=
nullptr
);
CAF_
ASSERT
(
me
.
typenr
!=
0
||
me
.
type
!=
nullptr
);
if
(
!
msg
.
match_element
(
pos
,
me
.
typenr
,
me
.
type
))
{
if
(
!
msg
.
match_element
(
pos
,
me
.
typenr
,
me
.
type
))
{
return
false
;
return
false
;
}
}
...
@@ -40,7 +40,7 @@ bool match_element(const meta_element& me, const message& msg,
...
@@ -40,7 +40,7 @@ bool match_element(const meta_element& me, const message& msg,
bool
match_atom_constant
(
const
meta_element
&
me
,
const
message
&
msg
,
bool
match_atom_constant
(
const
meta_element
&
me
,
const
message
&
msg
,
size_t
pos
,
void
**
storage
)
{
size_t
pos
,
void
**
storage
)
{
CAF_
REQUIRE
(
me
.
typenr
==
detail
::
type_nr
<
atom_value
>::
value
);
CAF_
ASSERT
(
me
.
typenr
==
detail
::
type_nr
<
atom_value
>::
value
);
if
(
!
msg
.
match_element
(
pos
,
detail
::
type_nr
<
atom_value
>::
value
,
nullptr
))
{
if
(
!
msg
.
match_element
(
pos
,
detail
::
type_nr
<
atom_value
>::
value
,
nullptr
))
{
return
false
;
return
false
;
}
}
...
@@ -126,8 +126,8 @@ bool try_match(const message& msg, size_t msg_pos, size_t msg_size,
...
@@ -126,8 +126,8 @@ bool try_match(const message& msg, size_t msg_pos, size_t msg_size,
}
}
bool
try_match
(
const
message
&
msg
,
pattern_iterator
pb
,
size_t
ps
,
void
**
out
)
{
bool
try_match
(
const
message
&
msg
,
pattern_iterator
pb
,
size_t
ps
,
void
**
out
)
{
CAF_
REQUIRE
(
out
!=
nullptr
);
CAF_
ASSERT
(
out
!=
nullptr
);
CAF_
REQUIRE
(
msg
.
empty
()
||
msg
.
vals
()
->
get_reference_count
()
>
0
);
CAF_
ASSERT
(
msg
.
empty
()
||
msg
.
vals
()
->
get_reference_count
()
>
0
);
set_commit_rollback
scr
{
out
};
set_commit_rollback
scr
{
out
};
return
try_match
(
msg
,
0
,
msg
.
size
(),
pb
,
pb
+
ps
,
scr
);
return
try_match
(
msg
,
0
,
msg
.
size
(),
pb
,
pb
+
ps
,
scr
);
}
}
...
...
libcaf_core/src/uniform_type_info.cpp
View file @
23f6f248
...
@@ -102,7 +102,7 @@ std::vector<const uniform_type_info*> uniform_type_info::instances() {
...
@@ -102,7 +102,7 @@ std::vector<const uniform_type_info*> uniform_type_info::instances() {
}
}
const
uniform_type_info
*
uniform_typeid_by_nr
(
uint16_t
nr
)
{
const
uniform_type_info
*
uniform_typeid_by_nr
(
uint16_t
nr
)
{
CAF_
REQUIRE
(
nr
>
0
&&
nr
<
detail
::
type_nrs
);
CAF_
ASSERT
(
nr
>
0
&&
nr
<
detail
::
type_nrs
);
return
uti_map
().
by_type_nr
(
nr
);
return
uti_map
().
by_type_nr
(
nr
);
}
}
...
...
libcaf_core/src/uniform_type_info_map.cpp
View file @
23f6f248
...
@@ -184,7 +184,7 @@ void serialize_impl(const channel& chref, serializer* sink) {
...
@@ -184,7 +184,7 @@ void serialize_impl(const channel& chref, serializer* sink) {
}
else
{
}
else
{
// raw pointer
// raw pointer
auto
rptr
=
actor_cast
<
abstract_channel
*>
(
chref
);
auto
rptr
=
actor_cast
<
abstract_channel
*>
(
chref
);
CAF_
REQUIRE
(
rptr
->
is_abstract_actor
()
||
rptr
->
is_abstract_group
());
CAF_
ASSERT
(
rptr
->
is_abstract_actor
()
||
rptr
->
is_abstract_group
());
if
(
rptr
->
is_abstract_actor
())
{
if
(
rptr
->
is_abstract_actor
())
{
// raw actor pointer
// raw actor pointer
abstract_actor_ptr
aptr
=
static_cast
<
abstract_actor
*>
(
rptr
);
abstract_actor_ptr
aptr
=
static_cast
<
abstract_actor
*>
(
rptr
);
...
@@ -495,7 +495,7 @@ class default_meta_message : public uniform_type_info {
...
@@ -495,7 +495,7 @@ class default_meta_message : public uniform_type_info {
std
::
vector
<
std
::
string
>
elements
;
std
::
vector
<
std
::
string
>
elements
;
split
(
elements
,
tname
,
is_any_of
(
"+"
));
split
(
elements
,
tname
,
is_any_of
(
"+"
));
auto
uti_map
=
detail
::
singletons
::
get_uniform_type_info_map
();
auto
uti_map
=
detail
::
singletons
::
get_uniform_type_info_map
();
CAF_
REQUIRE
(
elements
.
size
()
>
0
&&
elements
.
front
()
==
"@<>"
);
CAF_
ASSERT
(
elements
.
size
()
>
0
&&
elements
.
front
()
==
"@<>"
);
// ignore first element, because it's always "@<>"
// ignore first element, because it's always "@<>"
for
(
size_t
i
=
1
;
i
!=
elements
.
size
();
++
i
)
{
for
(
size_t
i
=
1
;
i
!=
elements
.
size
();
++
i
)
{
try
{
try
{
...
@@ -524,7 +524,7 @@ class default_meta_message : public uniform_type_info {
...
@@ -524,7 +524,7 @@ class default_meta_message : public uniform_type_info {
}
}
void
serialize
(
const
void
*
ptr
,
serializer
*
sink
)
const
override
{
void
serialize
(
const
void
*
ptr
,
serializer
*
sink
)
const
override
{
auto
&
msg
=
*
cast
(
ptr
);
auto
&
msg
=
*
cast
(
ptr
);
CAF_
REQUIRE
(
msg
.
size
()
==
m_elements
.
size
());
CAF_
ASSERT
(
msg
.
size
()
==
m_elements
.
size
());
for
(
size_t
i
=
0
;
i
<
m_elements
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
m_elements
.
size
();
++
i
)
{
m_elements
[
i
]
->
serialize
(
msg
.
at
(
i
),
sink
);
m_elements
[
i
]
->
serialize
(
msg
.
at
(
i
),
sink
);
}
}
...
@@ -595,7 +595,7 @@ class utim_impl : public uniform_type_info_map {
...
@@ -595,7 +595,7 @@ class utim_impl : public uniform_type_info_map {
fill_uti_arr
(
std
::
integral_constant
<
size_t
,
0
>
{},
fill_uti_arr
(
std
::
integral_constant
<
size_t
,
0
>
{},
m_builtin_types
,
m_storage
);
m_builtin_types
,
m_storage
);
// make sure our builtin types are sorted
// make sure our builtin types are sorted
CAF_
REQUIRE
(
std
::
is_sorted
(
m_builtin_types
.
begin
(),
CAF_
ASSERT
(
std
::
is_sorted
(
m_builtin_types
.
begin
(),
m_builtin_types
.
end
(),
m_builtin_types
.
end
(),
[](
pointer
lhs
,
pointer
rhs
)
{
[](
pointer
lhs
,
pointer
rhs
)
{
return
strcmp
(
lhs
->
name
(),
rhs
->
name
())
<
0
;
return
strcmp
(
lhs
->
name
(),
rhs
->
name
())
<
0
;
...
@@ -603,7 +603,7 @@ class utim_impl : public uniform_type_info_map {
...
@@ -603,7 +603,7 @@ class utim_impl : public uniform_type_info_map {
}
}
virtual
pointer
by_type_nr
(
uint16_t
nr
)
const
{
virtual
pointer
by_type_nr
(
uint16_t
nr
)
const
{
CAF_
REQUIRE
(
nr
>
0
);
CAF_
ASSERT
(
nr
>
0
);
return
m_builtin_types
[
nr
-
1
];
return
m_builtin_types
[
nr
-
1
];
}
}
...
...
libcaf_io/caf/io/broker.hpp
View file @
23f6f248
...
@@ -237,7 +237,7 @@ class broker : public abstract_event_based_actor<behavior, false> {
...
@@ -237,7 +237,7 @@ class broker : public abstract_event_based_actor<behavior, false> {
throw
std
::
invalid_argument
(
"invalid handle"
);
throw
std
::
invalid_argument
(
"invalid handle"
);
}
}
auto
sptr
=
i
->
second
;
auto
sptr
=
i
->
second
;
CAF_
REQUIRE
(
sptr
->
hdl
()
==
hdl
);
CAF_
ASSERT
(
sptr
->
hdl
()
==
hdl
);
m_scribes
.
erase
(
i
);
m_scribes
.
erase
(
i
);
return
spawn_functor
(
nullptr
,
[
sptr
](
broker
*
forked
)
{
return
spawn_functor
(
nullptr
,
[
sptr
](
broker
*
forked
)
{
sptr
->
set_broker
(
forked
);
sptr
->
set_broker
(
forked
);
...
...
libcaf_io/caf/io/middleman.hpp
View file @
23f6f248
...
@@ -68,7 +68,7 @@ class middleman : public detail::abstract_singleton {
...
@@ -68,7 +68,7 @@ class middleman : public detail::abstract_singleton {
return
static_cast
<
Impl
*>
(
i
->
second
.
get
());
return
static_cast
<
Impl
*>
(
i
->
second
.
get
());
}
}
auto
result
=
make_counted
<
Impl
>
(
*
this
);
auto
result
=
make_counted
<
Impl
>
(
*
this
);
CAF_
REQUIRE
(
result
->
unique
());
CAF_
ASSERT
(
result
->
unique
());
result
->
launch
(
nullptr
,
false
,
true
);
result
->
launch
(
nullptr
,
false
,
true
);
m_named_brokers
.
insert
(
std
::
make_pair
(
name
,
result
));
m_named_brokers
.
insert
(
std
::
make_pair
(
name
,
result
));
return
result
;
return
result
;
...
...
libcaf_io/caf/io/network/default_multiplexer.hpp
View file @
23f6f248
...
@@ -351,8 +351,8 @@ class default_multiplexer : public multiplexer {
...
@@ -351,8 +351,8 @@ class default_multiplexer : public multiplexer {
template
<
class
F
>
template
<
class
F
>
void
new_event
(
F
fun
,
operation
op
,
native_socket
fd
,
event_handler
*
ptr
)
{
void
new_event
(
F
fun
,
operation
op
,
native_socket
fd
,
event_handler
*
ptr
)
{
CAF_
REQUIRE
(
fd
!=
invalid_native_socket
);
CAF_
ASSERT
(
fd
!=
invalid_native_socket
);
CAF_
REQUIRE
(
ptr
!=
nullptr
||
fd
==
m_pipe
.
first
);
CAF_
ASSERT
(
ptr
!=
nullptr
||
fd
==
m_pipe
.
first
);
// the only valid input where ptr == nullptr is our pipe
// the only valid input where ptr == nullptr is our pipe
// read handle which is only registered for reading
// read handle which is only registered for reading
auto
old_bf
=
ptr
?
ptr
->
eventbf
()
:
input_mask
;
auto
old_bf
=
ptr
?
ptr
->
eventbf
()
:
input_mask
;
...
@@ -362,7 +362,7 @@ class default_multiplexer : public multiplexer {
...
@@ -362,7 +362,7 @@ class default_multiplexer : public multiplexer {
auto
last
=
m_events
.
end
();
auto
last
=
m_events
.
end
();
auto
i
=
std
::
lower_bound
(
m_events
.
begin
(),
last
,
fd
,
event_less
{});
auto
i
=
std
::
lower_bound
(
m_events
.
begin
(),
last
,
fd
,
event_less
{});
if
(
i
!=
last
&&
i
->
fd
==
fd
)
{
if
(
i
!=
last
&&
i
->
fd
==
fd
)
{
CAF_
REQUIRE
(
ptr
==
i
->
ptr
);
CAF_
ASSERT
(
ptr
==
i
->
ptr
);
// squash events together
// squash events together
CAF_LOG_DEBUG
(
"squash events: "
<<
i
->
mask
<<
" -> "
CAF_LOG_DEBUG
(
"squash events: "
<<
i
->
mask
<<
" -> "
<<
fun
(
op
,
i
->
mask
));
<<
fun
(
op
,
i
->
mask
));
...
@@ -467,7 +467,7 @@ class stream : public event_handler {
...
@@ -467,7 +467,7 @@ class stream : public event_handler {
* Starts reading data from the socket, forwarding incoming data to `mgr`.
* Starts reading data from the socket, forwarding incoming data to `mgr`.
*/
*/
void
start
(
const
manager_ptr
&
mgr
)
{
void
start
(
const
manager_ptr
&
mgr
)
{
CAF_
REQUIRE
(
mgr
!=
nullptr
);
CAF_
ASSERT
(
mgr
!=
nullptr
);
m_reader
=
mgr
;
m_reader
=
mgr
;
backend
().
add
(
operation
::
read
,
m_sock
.
fd
(),
this
);
backend
().
add
(
operation
::
read
,
m_sock
.
fd
(),
this
);
read_loop
();
read_loop
();
...
@@ -522,7 +522,7 @@ class stream : public event_handler {
...
@@ -522,7 +522,7 @@ class stream : public event_handler {
* once the stream has been started.
* once the stream has been started.
*/
*/
void
flush
(
const
manager_ptr
&
mgr
)
{
void
flush
(
const
manager_ptr
&
mgr
)
{
CAF_
REQUIRE
(
mgr
!=
nullptr
);
CAF_
ASSERT
(
mgr
!=
nullptr
);
CAF_LOG_TRACE
(
"offline buf size: "
<<
m_wr_offline_buf
.
size
()
CAF_LOG_TRACE
(
"offline buf size: "
<<
m_wr_offline_buf
.
size
()
<<
", mgr = "
<<
mgr
.
get
()
<<
", mgr = "
<<
mgr
.
get
()
<<
", m_writer = "
<<
m_writer
.
get
());
<<
", m_writer = "
<<
m_writer
.
get
());
...
@@ -707,7 +707,7 @@ class acceptor : public event_handler {
...
@@ -707,7 +707,7 @@ class acceptor : public event_handler {
*/
*/
void
start
(
const
manager_ptr
&
mgr
)
{
void
start
(
const
manager_ptr
&
mgr
)
{
CAF_LOG_TRACE
(
"m_accept_sock.fd = "
<<
m_accept_sock
.
fd
());
CAF_LOG_TRACE
(
"m_accept_sock.fd = "
<<
m_accept_sock
.
fd
());
CAF_
REQUIRE
(
mgr
!=
nullptr
);
CAF_
ASSERT
(
mgr
!=
nullptr
);
m_mgr
=
mgr
;
m_mgr
=
mgr
;
backend
().
add
(
operation
::
read
,
m_accept_sock
.
fd
(),
this
);
backend
().
add
(
operation
::
read
,
m_accept_sock
.
fd
(),
this
);
}
}
...
...
libcaf_io/caf/io/receive_policy.hpp
View file @
23f6f248
...
@@ -22,17 +22,17 @@ class receive_policy {
...
@@ -22,17 +22,17 @@ class receive_policy {
using
config
=
std
::
pair
<
receive_policy_flag
,
size_t
>
;
using
config
=
std
::
pair
<
receive_policy_flag
,
size_t
>
;
static
inline
config
at_least
(
size_t
num_bytes
)
{
static
inline
config
at_least
(
size_t
num_bytes
)
{
CAF_
REQUIRE
(
num_bytes
>
0
);
CAF_
ASSERT
(
num_bytes
>
0
);
return
{
receive_policy_flag
::
at_least
,
num_bytes
};
return
{
receive_policy_flag
::
at_least
,
num_bytes
};
}
}
static
inline
config
at_most
(
size_t
num_bytes
)
{
static
inline
config
at_most
(
size_t
num_bytes
)
{
CAF_
REQUIRE
(
num_bytes
>
0
);
CAF_
ASSERT
(
num_bytes
>
0
);
return
{
receive_policy_flag
::
at_most
,
num_bytes
};
return
{
receive_policy_flag
::
at_most
,
num_bytes
};
}
}
static
inline
config
exactly
(
size_t
num_bytes
)
{
static
inline
config
exactly
(
size_t
num_bytes
)
{
CAF_
REQUIRE
(
num_bytes
>
0
);
CAF_
ASSERT
(
num_bytes
>
0
);
return
{
receive_policy_flag
::
exactly
,
num_bytes
};
return
{
receive_policy_flag
::
exactly
,
num_bytes
};
}
}
...
...
libcaf_io/src/basp_broker.cpp
View file @
23f6f248
...
@@ -82,13 +82,13 @@ behavior basp_broker::make_behavior() {
...
@@ -82,13 +82,13 @@ behavior basp_broker::make_behavior() {
// received from underlying broker implementation
// received from underlying broker implementation
[
=
](
new_data_msg
&
msg
)
{
[
=
](
new_data_msg
&
msg
)
{
CAF_LOG_TRACE
(
"handle = "
<<
msg
.
handle
.
id
());
CAF_LOG_TRACE
(
"handle = "
<<
msg
.
handle
.
id
());
CAF_
REQUIRE
(
m_ctx
.
count
(
msg
.
handle
)
>
0
);
CAF_
ASSERT
(
m_ctx
.
count
(
msg
.
handle
)
>
0
);
new_data
(
m_ctx
[
msg
.
handle
],
msg
.
buf
);
new_data
(
m_ctx
[
msg
.
handle
],
msg
.
buf
);
},
},
// received from underlying broker implementation
// received from underlying broker implementation
[
=
](
const
new_connection_msg
&
msg
)
{
[
=
](
const
new_connection_msg
&
msg
)
{
CAF_LOG_TRACE
(
"handle = "
<<
msg
.
handle
.
id
());
CAF_LOG_TRACE
(
"handle = "
<<
msg
.
handle
.
id
());
CAF_
REQUIRE
(
m_ctx
.
count
(
msg
.
handle
)
==
0
);
CAF_
ASSERT
(
m_ctx
.
count
(
msg
.
handle
)
==
0
);
auto
&
ctx
=
m_ctx
[
msg
.
handle
];
auto
&
ctx
=
m_ctx
[
msg
.
handle
];
ctx
.
hdl
=
msg
.
handle
;
ctx
.
hdl
=
msg
.
handle
;
ctx
.
handshake_data
=
none
;
ctx
.
handshake_data
=
none
;
...
@@ -287,7 +287,7 @@ void basp_broker::local_dispatch(const basp::header& hdr, message&& msg) {
...
@@ -287,7 +287,7 @@ void basp_broker::local_dispatch(const basp::header& hdr, message&& msg) {
}
}
CAF_LOG_DEBUG_IF
(
src
==
invalid_actor_addr
,
"src == invalid_actor_addr"
);
CAF_LOG_DEBUG_IF
(
src
==
invalid_actor_addr
,
"src == invalid_actor_addr"
);
auto
dest
=
singletons
::
get_actor_registry
()
->
get
(
hdr
.
dest_actor
);
auto
dest
=
singletons
::
get_actor_registry
()
->
get
(
hdr
.
dest_actor
);
CAF_
REQUIRE
(
!
dest
||
dest
->
node
()
==
node
());
CAF_
ASSERT
(
!
dest
||
dest
->
node
()
==
node
());
// intercept message used for link signaling
// intercept message used for link signaling
if
(
dest
&&
src
==
dest
)
{
if
(
dest
&&
src
==
dest
)
{
if
(
msg
.
match_elements
<
atom_value
,
actor_addr
>
())
{
if
(
msg
.
match_elements
<
atom_value
,
actor_addr
>
())
{
...
@@ -473,7 +473,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -473,7 +473,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
// must not happen
// must not happen
throw
std
::
logic_error
(
"invalid operation"
);
throw
std
::
logic_error
(
"invalid operation"
);
case
basp
:
:
dispatch_message
:
{
case
basp
:
:
dispatch_message
:
{
CAF_
REQUIRE
(
payload
!=
nullptr
);
CAF_
ASSERT
(
payload
!=
nullptr
);
binary_deserializer
bd
{
payload
->
data
(),
payload
->
size
(),
&
m_namespace
};
binary_deserializer
bd
{
payload
->
data
(),
payload
->
size
(),
&
m_namespace
};
message
content
;
message
content
;
bd
.
read
(
content
,
m_meta_msg
);
bd
.
read
(
content
,
m_meta_msg
);
...
@@ -481,7 +481,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -481,7 +481,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
break
;
break
;
}
}
case
basp
:
:
announce_proxy_instance
:
{
case
basp
:
:
announce_proxy_instance
:
{
CAF_
REQUIRE
(
payload
==
nullptr
);
CAF_
ASSERT
(
payload
==
nullptr
);
// source node has created a proxy for one of our actors
// source node has created a proxy for one of our actors
auto
entry
=
singletons
::
get_actor_registry
()
->
get_entry
(
hdr
.
dest_actor
);
auto
entry
=
singletons
::
get_actor_registry
()
->
get_entry
(
hdr
.
dest_actor
);
auto
nid
=
hdr
.
source_node
;
auto
nid
=
hdr
.
source_node
;
...
@@ -501,7 +501,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -501,7 +501,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
break
;
break
;
}
}
case
basp
:
:
kill_proxy_instance
:
{
case
basp
:
:
kill_proxy_instance
:
{
CAF_
REQUIRE
(
payload
==
nullptr
);
CAF_
ASSERT
(
payload
==
nullptr
);
// we have a proxy to an actor that has been terminated
// we have a proxy to an actor that has been terminated
auto
ptr
=
m_namespace
.
get
(
hdr
.
source_node
,
hdr
.
source_actor
);
auto
ptr
=
m_namespace
.
get
(
hdr
.
source_node
,
hdr
.
source_actor
);
if
(
ptr
)
{
if
(
ptr
)
{
...
@@ -513,7 +513,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -513,7 +513,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
break
;
break
;
}
}
case
basp
:
:
client_handshake
:
{
case
basp
:
:
client_handshake
:
{
CAF_
REQUIRE
(
payload
==
nullptr
);
CAF_
ASSERT
(
payload
==
nullptr
);
if
(
ctx
.
remote_id
!=
invalid_node_id
)
{
if
(
ctx
.
remote_id
!=
invalid_node_id
)
{
CAF_LOG_INFO
(
"received unexpected client handshake"
);
CAF_LOG_INFO
(
"received unexpected client handshake"
);
return
close_connection
;
return
close_connection
;
...
@@ -531,7 +531,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
...
@@ -531,7 +531,7 @@ basp_broker::handle_basp_header(connection_context& ctx,
break
;
break
;
}
}
case
basp
:
:
server_handshake
:
{
case
basp
:
:
server_handshake
:
{
CAF_
REQUIRE
(
payload
!=
nullptr
);
CAF_
ASSERT
(
payload
!=
nullptr
);
if
(
!
ctx
.
handshake_data
)
{
if
(
!
ctx
.
handshake_data
)
{
CAF_LOG_INFO
(
"received unexpected server handshake"
);
CAF_LOG_INFO
(
"received unexpected server handshake"
);
return
close_connection
;
return
close_connection
;
...
@@ -653,9 +653,9 @@ basp_broker::connection_info basp_broker::get_route(const node_id& dest) {
...
@@ -653,9 +653,9 @@ basp_broker::connection_info basp_broker::get_route(const node_id& dest) {
actor_proxy_ptr
basp_broker
::
make_proxy
(
const
node_id
&
nid
,
actor_id
aid
)
{
actor_proxy_ptr
basp_broker
::
make_proxy
(
const
node_id
&
nid
,
actor_id
aid
)
{
CAF_LOG_TRACE
(
CAF_TSARG
(
nid
)
<<
", "
CAF_LOG_TRACE
(
CAF_TSARG
(
nid
)
<<
", "
<<
CAF_ARG
(
aid
));
<<
CAF_ARG
(
aid
));
CAF_
REQUIRE
(
m_current_context
!=
nullptr
);
CAF_
ASSERT
(
m_current_context
!=
nullptr
);
CAF_
REQUIRE
(
aid
!=
invalid_actor_id
);
CAF_
ASSERT
(
aid
!=
invalid_actor_id
);
CAF_
REQUIRE
(
nid
!=
node
());
CAF_
ASSERT
(
nid
!=
node
());
// this member function is being called whenever we deserialize a
// this member function is being called whenever we deserialize a
// payload received from a remote node; if a remote node N sends
// payload received from a remote node; if a remote node N sends
// us a handle to a third node T, we assume that N has a route to T
// us a handle to a third node T, we assume that N has a route to T
...
@@ -697,7 +697,7 @@ void basp_broker::on_exit() {
...
@@ -697,7 +697,7 @@ void basp_broker::on_exit() {
// kill all remaining proxies
// kill all remaining proxies
auto
proxies
=
m_namespace
.
get_all
();
auto
proxies
=
m_namespace
.
get_all
();
for
(
auto
&
proxy
:
proxies
)
{
for
(
auto
&
proxy
:
proxies
)
{
CAF_
REQUIRE
(
proxy
!=
nullptr
);
CAF_
ASSERT
(
proxy
!=
nullptr
);
proxy
->
kill_proxy
(
exit_reason
::
remote_link_unreachable
);
proxy
->
kill_proxy
(
exit_reason
::
remote_link_unreachable
);
}
}
m_namespace
.
clear
();
m_namespace
.
clear
();
...
@@ -727,7 +727,7 @@ void basp_broker::add_route(const node_id& nid, connection_handle hdl) {
...
@@ -727,7 +727,7 @@ void basp_broker::add_route(const node_id& nid, connection_handle hdl) {
bool
basp_broker
::
try_set_default_route
(
const
node_id
&
nid
,
bool
basp_broker
::
try_set_default_route
(
const
node_id
&
nid
,
connection_handle
hdl
)
{
connection_handle
hdl
)
{
CAF_
REQUIRE
(
!
hdl
.
invalid
());
CAF_
ASSERT
(
!
hdl
.
invalid
());
auto
&
entry
=
m_routes
[
nid
];
auto
&
entry
=
m_routes
[
nid
];
if
(
entry
.
first
.
invalid
())
{
if
(
entry
.
first
.
invalid
())
{
CAF_LOG_DEBUG
(
"new default route: "
<<
to_string
(
nid
)
<<
" -> "
CAF_LOG_DEBUG
(
"new default route: "
<<
to_string
(
nid
)
<<
" -> "
...
@@ -747,7 +747,7 @@ void basp_broker::init_handshake_as_client(connection_context& ctx) {
...
@@ -747,7 +747,7 @@ void basp_broker::init_handshake_as_client(connection_context& ctx) {
void
basp_broker
::
init_handshake_as_server
(
connection_context
&
ctx
,
void
basp_broker
::
init_handshake_as_server
(
connection_context
&
ctx
,
actor_addr
addr
)
{
actor_addr
addr
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
this
));
CAF_LOG_TRACE
(
CAF_ARG
(
this
));
CAF_
REQUIRE
(
node
()
!=
invalid_node_id
);
CAF_
ASSERT
(
node
()
!=
invalid_node_id
);
if
(
addr
!=
invalid_actor_addr
)
{
if
(
addr
!=
invalid_actor_addr
)
{
auto
writer
=
make_payload_writer
([
&
](
binary_serializer
&
sink
)
{
auto
writer
=
make_payload_writer
([
&
](
binary_serializer
&
sink
)
{
sink
<<
addr
.
id
();
sink
<<
addr
.
id
();
...
@@ -787,14 +787,14 @@ void basp_broker::add_published_actor(accept_handle hdl,
...
@@ -787,14 +787,14 @@ void basp_broker::add_published_actor(accept_handle hdl,
bool
basp_broker
::
remove_published_actor
(
const
abstract_actor_ptr
&
whom
)
{
bool
basp_broker
::
remove_published_actor
(
const
abstract_actor_ptr
&
whom
)
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
CAF_
REQUIRE
(
whom
!=
nullptr
);
CAF_
ASSERT
(
whom
!=
nullptr
);
size_t
erased_elements
=
0
;
size_t
erased_elements
=
0
;
auto
last
=
m_acceptors
.
end
();
auto
last
=
m_acceptors
.
end
();
auto
i
=
m_acceptors
.
begin
();
auto
i
=
m_acceptors
.
begin
();
while
(
i
!=
last
)
{
while
(
i
!=
last
)
{
auto
&
kvp
=
i
->
second
;
auto
&
kvp
=
i
->
second
;
if
(
kvp
.
first
==
whom
)
{
if
(
kvp
.
first
==
whom
)
{
CAF_
REQUIRE
(
valid
(
i
->
first
));
CAF_
ASSERT
(
valid
(
i
->
first
));
close
(
i
->
first
);
close
(
i
->
first
);
if
(
m_open_ports
.
erase
(
kvp
.
second
)
==
0
)
{
if
(
m_open_ports
.
erase
(
kvp
.
second
)
==
0
)
{
CAF_LOG_ERROR
(
"inconsistent data: no open port for acceptor!"
);
CAF_LOG_ERROR
(
"inconsistent data: no open port for acceptor!"
);
...
@@ -812,13 +812,13 @@ bool basp_broker::remove_published_actor(const abstract_actor_ptr& whom) {
...
@@ -812,13 +812,13 @@ bool basp_broker::remove_published_actor(const abstract_actor_ptr& whom) {
bool
basp_broker
::
remove_published_actor
(
const
abstract_actor_ptr
&
whom
,
bool
basp_broker
::
remove_published_actor
(
const
abstract_actor_ptr
&
whom
,
uint16_t
port
)
{
uint16_t
port
)
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
CAF_
REQUIRE
(
whom
!=
nullptr
);
CAF_
ASSERT
(
whom
!=
nullptr
);
CAF_
REQUIRE
(
port
!=
0
);
CAF_
ASSERT
(
port
!=
0
);
auto
i
=
m_open_ports
.
find
(
port
);
auto
i
=
m_open_ports
.
find
(
port
);
if
(
i
==
m_open_ports
.
end
())
{
if
(
i
==
m_open_ports
.
end
())
{
return
false
;
return
false
;
}
}
CAF_
REQUIRE
(
valid
(
i
->
second
));
CAF_
ASSERT
(
valid
(
i
->
second
));
auto
j
=
m_acceptors
.
find
(
i
->
second
);
auto
j
=
m_acceptors
.
find
(
i
->
second
);
if
(
j
->
second
.
first
!=
whom
)
{
if
(
j
->
second
.
first
!=
whom
)
{
CAF_LOG_INFO
(
"port has been bound to a different actor"
);
CAF_LOG_INFO
(
"port has been bound to a different actor"
);
...
...
libcaf_io/src/broker.cpp
View file @
23f6f248
...
@@ -268,9 +268,9 @@ void broker::cleanup(uint32_t reason) {
...
@@ -268,9 +268,9 @@ void broker::cleanup(uint32_t reason) {
planned_exit_reason
(
reason
);
planned_exit_reason
(
reason
);
on_exit
();
on_exit
();
close_all
();
close_all
();
CAF_
REQUIRE
(
m_doormen
.
empty
());
CAF_
ASSERT
(
m_doormen
.
empty
());
CAF_
REQUIRE
(
m_scribes
.
empty
());
CAF_
ASSERT
(
m_scribes
.
empty
());
CAF_
REQUIRE
(
current_mailbox_element
()
==
nullptr
);
CAF_
ASSERT
(
current_mailbox_element
()
==
nullptr
);
m_cache
.
clear
();
m_cache
.
clear
();
super
::
cleanup
(
reason
);
super
::
cleanup
(
reason
);
deref
();
// release implicit reference count from middleman
deref
();
// release implicit reference count from middleman
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
23f6f248
...
@@ -314,7 +314,7 @@ namespace network {
...
@@ -314,7 +314,7 @@ namespace network {
CAF_LOG_TRACE
(
"e.fd = "
<<
e
.
fd
<<
", mask = "
<<
e
.
mask
);
CAF_LOG_TRACE
(
"e.fd = "
<<
e
.
fd
<<
", mask = "
<<
e
.
mask
);
// ptr is only allowed to nullptr if fd is our pipe
// ptr is only allowed to nullptr if fd is our pipe
// read handle which is only registered for input
// read handle which is only registered for input
CAF_
REQUIRE
(
e
.
ptr
!=
nullptr
||
e
.
fd
==
m_pipe
.
first
);
CAF_
ASSERT
(
e
.
ptr
!=
nullptr
||
e
.
fd
==
m_pipe
.
first
);
if
(
e
.
ptr
&&
e
.
ptr
->
eventbf
()
==
e
.
mask
)
{
if
(
e
.
ptr
&&
e
.
ptr
->
eventbf
()
==
e
.
mask
)
{
// nop
// nop
return
;
return
;
...
@@ -472,8 +472,8 @@ namespace network {
...
@@ -472,8 +472,8 @@ namespace network {
}
}
void
default_multiplexer
::
handle
(
const
default_multiplexer
::
event
&
e
)
{
void
default_multiplexer
::
handle
(
const
default_multiplexer
::
event
&
e
)
{
CAF_
REQUIRE
(
e
.
fd
!=
invalid_native_socket
);
CAF_
ASSERT
(
e
.
fd
!=
invalid_native_socket
);
CAF_
REQUIRE
(
m_pollset
.
size
()
==
m_shadow
.
size
());
CAF_
ASSERT
(
m_pollset
.
size
()
==
m_shadow
.
size
());
CAF_LOGF_TRACE
(
"fd = "
<<
e
.
fd
CAF_LOGF_TRACE
(
"fd = "
<<
e
.
fd
<<
", old mask = "
<<
(
e
.
ptr
?
e
.
ptr
->
eventbf
()
:
-
1
)
<<
", old mask = "
<<
(
e
.
ptr
?
e
.
ptr
->
eventbf
()
:
-
1
)
<<
", new mask = "
<<
e
.
mask
);
<<
", new mask = "
<<
e
.
mask
);
...
@@ -513,7 +513,7 @@ namespace network {
...
@@ -513,7 +513,7 @@ namespace network {
m_shadow
.
erase
(
j
);
m_shadow
.
erase
(
j
);
}
else
{
}
else
{
// update event mask of existing entry
// update event mask of existing entry
CAF_
REQUIRE
(
*
j
==
e
.
ptr
);
CAF_
ASSERT
(
*
j
==
e
.
ptr
);
i
->
events
=
static_cast
<
short
>
(
e
.
mask
);
i
->
events
=
static_cast
<
short
>
(
e
.
mask
);
}
}
if
(
e
.
ptr
)
{
if
(
e
.
ptr
)
{
...
@@ -563,10 +563,10 @@ int del_flag(operation op, int bf) {
...
@@ -563,10 +563,10 @@ int del_flag(operation op, int bf) {
void
default_multiplexer
::
add
(
operation
op
,
native_socket
fd
,
void
default_multiplexer
::
add
(
operation
op
,
native_socket
fd
,
event_handler
*
ptr
)
{
event_handler
*
ptr
)
{
CAF_
REQUIRE
(
fd
!=
invalid_native_socket
);
CAF_
ASSERT
(
fd
!=
invalid_native_socket
);
// ptr == nullptr is only allowed to store our pipe read handle
// ptr == nullptr is only allowed to store our pipe read handle
// and the pipe read handle is added in the ctor (not allowed here)
// and the pipe read handle is added in the ctor (not allowed here)
CAF_
REQUIRE
(
ptr
!=
nullptr
);
CAF_
ASSERT
(
ptr
!=
nullptr
);
CAF_LOG_TRACE
(
CAF_TARG
(
op
,
static_cast
<
int
>
)
<<
", "
<<
CAF_ARG
(
fd
)
CAF_LOG_TRACE
(
CAF_TARG
(
op
,
static_cast
<
int
>
)
<<
", "
<<
CAF_ARG
(
fd
)
<<
", "
CAF_ARG
(
ptr
));
<<
", "
CAF_ARG
(
ptr
));
new_event
(
add_flag
,
op
,
fd
,
ptr
);
new_event
(
add_flag
,
op
,
fd
,
ptr
);
...
@@ -574,9 +574,9 @@ void default_multiplexer::add(operation op, native_socket fd,
...
@@ -574,9 +574,9 @@ void default_multiplexer::add(operation op, native_socket fd,
void
default_multiplexer
::
del
(
operation
op
,
native_socket
fd
,
void
default_multiplexer
::
del
(
operation
op
,
native_socket
fd
,
event_handler
*
ptr
)
{
event_handler
*
ptr
)
{
CAF_
REQUIRE
(
fd
!=
invalid_native_socket
);
CAF_
ASSERT
(
fd
!=
invalid_native_socket
);
// ptr == nullptr is only allowed when removing our pipe read handle
// ptr == nullptr is only allowed when removing our pipe read handle
CAF_
REQUIRE
(
ptr
!=
nullptr
||
fd
==
m_pipe
.
first
);
CAF_
ASSERT
(
ptr
!=
nullptr
||
fd
==
m_pipe
.
first
);
CAF_LOG_TRACE
(
CAF_TARG
(
op
,
static_cast
<
int
>
)
<<
", "
<<
CAF_ARG
(
fd
)
CAF_LOG_TRACE
(
CAF_TARG
(
op
,
static_cast
<
int
>
)
<<
", "
<<
CAF_ARG
(
fd
)
<<
", "
CAF_ARG
(
ptr
));
<<
", "
CAF_ARG
(
ptr
));
new_event
(
del_flag
,
op
,
fd
,
ptr
);
new_event
(
del_flag
,
op
,
fd
,
ptr
);
...
@@ -663,7 +663,7 @@ void default_multiplexer::handle_socket_event(native_socket fd, int mask,
...
@@ -663,7 +663,7 @@ void default_multiplexer::handle_socket_event(native_socket fd, int mask,
if
(
ptr
)
{
if
(
ptr
)
{
ptr
->
handle_event
(
operation
::
read
);
ptr
->
handle_event
(
operation
::
read
);
}
else
{
}
else
{
CAF_
REQUIRE
(
fd
==
m_pipe
.
first
);
CAF_
ASSERT
(
fd
==
m_pipe
.
first
);
CAF_LOG_DEBUG
(
"read message from pipe"
);
CAF_LOG_DEBUG
(
"read message from pipe"
);
auto
cb
=
rd_dispatch_request
();
auto
cb
=
rd_dispatch_request
();
cb
->
run
();
cb
->
run
();
...
@@ -672,7 +672,7 @@ void default_multiplexer::handle_socket_event(native_socket fd, int mask,
...
@@ -672,7 +672,7 @@ void default_multiplexer::handle_socket_event(native_socket fd, int mask,
}
}
if
(
mask
&
output_mask
)
{
if
(
mask
&
output_mask
)
{
// we do *never* register our pipe handle for writing
// we do *never* register our pipe handle for writing
CAF_
REQUIRE
(
ptr
!=
nullptr
);
CAF_
ASSERT
(
ptr
!=
nullptr
);
checkerror
=
false
;
checkerror
=
false
;
ptr
->
handle_event
(
operation
::
write
);
ptr
->
handle_event
(
operation
::
write
);
}
}
...
@@ -760,7 +760,7 @@ connection_handle default_multiplexer::add_tcp_scribe(broker* self,
...
@@ -760,7 +760,7 @@ connection_handle default_multiplexer::add_tcp_scribe(broker* self,
}
}
void
launch
()
{
void
launch
()
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
CAF_
REQUIRE
(
!
m_launched
);
CAF_
ASSERT
(
!
m_launched
);
m_launched
=
true
;
m_launched
=
true
;
m_stream
.
start
(
this
);
m_stream
.
start
(
this
);
}
}
...
@@ -777,7 +777,7 @@ accept_handle
...
@@ -777,7 +777,7 @@ accept_handle
default_multiplexer
::
add_tcp_doorman
(
broker
*
self
,
default_multiplexer
::
add_tcp_doorman
(
broker
*
self
,
default_socket_acceptor
&&
sock
)
{
default_socket_acceptor
&&
sock
)
{
CAF_LOG_TRACE
(
"sock.fd = "
<<
sock
.
fd
());
CAF_LOG_TRACE
(
"sock.fd = "
<<
sock
.
fd
());
CAF_
REQUIRE
(
sock
.
fd
()
!=
network
::
invalid_native_socket
);
CAF_
ASSERT
(
sock
.
fd
()
!=
network
::
invalid_native_socket
);
class
impl
:
public
broker
::
doorman
{
class
impl
:
public
broker
::
doorman
{
public:
public:
impl
(
broker
*
ptr
,
default_socket_acceptor
&&
s
)
impl
(
broker
*
ptr
,
default_socket_acceptor
&&
s
)
...
@@ -1069,7 +1069,7 @@ native_socket new_tcp_connection_impl(const std::string& host, uint16_t port,
...
@@ -1069,7 +1069,7 @@ native_socket new_tcp_connection_impl(const std::string& host, uint16_t port,
throw
network_error
(
"no such host: "
+
host
);
throw
network_error
(
"no such host: "
+
host
);
}
}
auto
proto
=
res
->
second
;
auto
proto
=
res
->
second
;
CAF_
REQUIRE
(
proto
==
ipv4
||
proto
==
ipv6
);
CAF_
ASSERT
(
proto
==
ipv4
||
proto
==
ipv6
);
auto
fd
=
ccall
(
cc_valid_socket
,
"socket creation failed"
,
socket
,
auto
fd
=
ccall
(
cc_valid_socket
,
"socket creation failed"
,
socket
,
proto
==
ipv4
?
AF_INET
:
AF_INET6
,
SOCK_STREAM
,
0
);
proto
==
ipv4
?
AF_INET
:
AF_INET6
,
SOCK_STREAM
,
0
);
socket_guard
sguard
(
fd
);
socket_guard
sguard
(
fd
);
...
@@ -1161,7 +1161,7 @@ new_tcp_acceptor_impl(uint16_t port, const char* addr, bool reuse_addr) {
...
@@ -1161,7 +1161,7 @@ new_tcp_acceptor_impl(uint16_t port, const char* addr, bool reuse_addr) {
throw
network_error
(
errmsg
);
throw
network_error
(
errmsg
);
}
}
proto
=
addrs
->
second
;
proto
=
addrs
->
second
;
CAF_
REQUIRE
(
proto
==
ipv4
||
proto
==
ipv6
);
CAF_
ASSERT
(
proto
==
ipv4
||
proto
==
ipv6
);
}
}
auto
fd
=
ccall
(
cc_valid_socket
,
"could not create server socket"
,
socket
,
auto
fd
=
ccall
(
cc_valid_socket
,
"could not create server socket"
,
socket
,
proto
==
ipv4
?
AF_INET
:
AF_INET6
,
SOCK_STREAM
,
0
);
proto
==
ipv4
?
AF_INET
:
AF_INET6
,
SOCK_STREAM
,
0
);
...
@@ -1188,7 +1188,7 @@ new_tcp_acceptor(uint16_t port, const char* addr, bool reuse) {
...
@@ -1188,7 +1188,7 @@ new_tcp_acceptor(uint16_t port, const char* addr, bool reuse) {
auto
&
backend
=
get_multiplexer_singleton
();
auto
&
backend
=
get_multiplexer_singleton
();
auto
acceptor
=
new_tcp_acceptor_impl
(
port
,
addr
,
reuse
);
auto
acceptor
=
new_tcp_acceptor_impl
(
port
,
addr
,
reuse
);
auto
bound_port
=
acceptor
.
second
;
auto
bound_port
=
acceptor
.
second
;
CAF_
REQUIRE
(
port
==
0
||
bound_port
==
port
);
CAF_
ASSERT
(
port
==
0
||
bound_port
==
port
);
return
{
default_socket_acceptor
{
backend
,
std
::
move
(
acceptor
.
first
)},
return
{
default_socket_acceptor
{
backend
,
std
::
move
(
acceptor
.
first
)},
bound_port
};
bound_port
};
}
}
...
...
libcaf_io/src/middleman.cpp
View file @
23f6f248
...
@@ -207,12 +207,12 @@ class middleman_actor_impl : public middleman_actor_base::base {
...
@@ -207,12 +207,12 @@ class middleman_actor_impl : public middleman_actor_base::base {
},
},
[
=
](
ok_atom
,
int64_t
request_id
)
{
[
=
](
ok_atom
,
int64_t
request_id
)
{
// not legal for get results
// not legal for get results
CAF_
REQUIRE
(
m_pending_gets
.
count
(
request_id
)
==
0
);
CAF_
ASSERT
(
m_pending_gets
.
count
(
request_id
)
==
0
);
handle_ok
<
del_op_result
>
(
m_pending_deletes
,
request_id
);
handle_ok
<
del_op_result
>
(
m_pending_deletes
,
request_id
);
},
},
[
=
](
ok_atom
,
int64_t
request_id
,
actor_addr
&
result
)
{
[
=
](
ok_atom
,
int64_t
request_id
,
actor_addr
&
result
)
{
// not legal for delete results
// not legal for delete results
CAF_
REQUIRE
(
m_pending_deletes
.
count
(
request_id
)
==
0
);
CAF_
ASSERT
(
m_pending_deletes
.
count
(
request_id
)
==
0
);
handle_ok
<
get_op_result
>
(
m_pending_gets
,
request_id
,
std
::
move
(
result
));
handle_ok
<
get_op_result
>
(
m_pending_gets
,
request_id
,
std
::
move
(
result
));
},
},
[
=
](
error_atom
,
int64_t
request_id
,
std
::
string
&
reason
)
{
[
=
](
error_atom
,
int64_t
request_id
,
std
::
string
&
reason
)
{
...
...
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