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
c077fbc0
Commit
c077fbc0
authored
Nov 23, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/warnings'
parents
9aeefaf7
dc0e57d7
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
96 additions
and
126 deletions
+96
-126
CMakeLists.txt
CMakeLists.txt
+1
-1
libcaf_core/caf/detail/parser/ascii_to_int.hpp
libcaf_core/caf/detail/parser/ascii_to_int.hpp
+8
-2
libcaf_core/caf/detail/parser/read_ipv4_address.hpp
libcaf_core/caf/detail/parser/read_ipv4_address.hpp
+2
-2
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+17
-8
libcaf_core/caf/policy/work_stealing.hpp
libcaf_core/caf/policy/work_stealing.hpp
+3
-2
libcaf_core/caf/sum_type.hpp
libcaf_core/caf/sum_type.hpp
+3
-3
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+0
-5
libcaf_core/src/config_option_set.cpp
libcaf_core/src/config_option_set.cpp
+3
-2
libcaf_core/src/ipv4_address.cpp
libcaf_core/src/ipv4_address.cpp
+2
-1
libcaf_core/src/ipv6_address.cpp
libcaf_core/src/ipv6_address.cpp
+4
-3
libcaf_core/src/make_config_option.cpp
libcaf_core/src/make_config_option.cpp
+3
-3
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+5
-5
libcaf_core/src/string_algorithms.cpp
libcaf_core/src/string_algorithms.cpp
+3
-2
libcaf_core/src/uri.cpp
libcaf_core/src/uri.cpp
+2
-1
libcaf_core/src/uri_impl.cpp
libcaf_core/src/uri_impl.cpp
+1
-1
libcaf_core/test/inbound_path.cpp
libcaf_core/test/inbound_path.cpp
+10
-10
libcaf_core/test/streambuf.cpp
libcaf_core/test/streambuf.cpp
+2
-2
libcaf_core/test/sum_type.cpp
libcaf_core/test/sum_type.cpp
+0
-12
libcaf_io/caf/io/network/receive_buffer.hpp
libcaf_io/caf/io/network/receive_buffer.hpp
+1
-1
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+0
-10
libcaf_io/test/basp.cpp
libcaf_io/test/basp.cpp
+0
-15
libcaf_io/test/basp_udp.cpp
libcaf_io/test/basp_udp.cpp
+0
-15
libcaf_openssl/src/manager.cpp
libcaf_openssl/src/manager.cpp
+21
-19
libcaf_openssl/src/middleman_actor.cpp
libcaf_openssl/src/middleman_actor.cpp
+1
-1
tools/caf-run.cpp
tools/caf-run.cpp
+4
-0
No files found.
CMakeLists.txt
View file @
c077fbc0
...
...
@@ -236,7 +236,7 @@ if(CAF_MORE_WARNINGS)
"-Wno-global-constructors -Wno-missing-prototypes "
"-Wno-c++98-compat-pedantic -Wno-unused-member-function "
"-Wno-unused-const-variable -Wno-switch-enum "
"-Wno-abstract-vbase-init "
"-Wno-abstract-vbase-init
-Wno-shadow
"
"-Wno-missing-noreturn -Wno-covered-switch-default"
)
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
set
(
WFLAGS
"-Waddress -Wall -Warray-bounds "
...
...
libcaf_core/caf/detail/parser/ascii_to_int.hpp
View file @
c077fbc0
...
...
@@ -27,7 +27,9 @@ template <int Base, class T>
struct
ascii_to_int
{
// @pre `c` is a valid ASCII digit, i.e., matches [0-9].
constexpr
T
operator
()(
char
c
)
const
{
return
c
-
'0'
;
// Result is guaranteed to have a value between 0 and 10 and can be safely
// cast to any integer type.
return
static_cast
<
T
>
(
c
-
'0'
);
}
};
...
...
@@ -38,7 +40,11 @@ struct ascii_to_int<16, T> {
// Numbers start at position 48 in the ASCII table.
// Uppercase characters start at position 65 in the ASCII table.
// Lowercase characters start at position 97 in the ASCII table.
return
c
<=
'9'
?
c
-
'0'
:
(
c
<=
'F'
?
10
+
(
c
-
'A'
)
:
10
+
(
c
-
'a'
));
// Result is guaranteed to have a value between 0 and 16 and can be safely
// cast to any integer type.
return
static_cast
<
T
>
(
c
<=
'9'
?
c
-
'0'
:
(
c
<=
'F'
?
10
+
(
c
-
'A'
)
:
10
+
(
c
-
'a'
)));
}
};
...
...
libcaf_core/caf/detail/parser/read_ipv4_address.hpp
View file @
c077fbc0
...
...
@@ -43,8 +43,8 @@ struct read_ipv4_octet_consumer {
std
::
array
<
uint8_t
,
4
>
bytes
;
int
octets
=
0
;
inline
void
value
(
uint8_t
octet
)
{
bytes
[
octets
++
]
=
octet
;
void
value
(
uint8_t
octet
)
{
bytes
[
static_cast
<
size_t
>
(
octets
++
)
]
=
octet
;
}
};
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
c077fbc0
...
...
@@ -159,7 +159,7 @@ struct is_primitive {
};
/// Checks whether `T1` is comparable with `T2`.
template
<
class
T1
,
typename
T2
>
template
<
class
T1
,
class
T2
>
class
is_comparable
{
// SFINAE: If you pass a "bool*" as third argument, then
// decltype(cmp_help_fun(...)) is bool if there's an
...
...
@@ -168,16 +168,25 @@ class is_comparable {
// cmp_help_fun(A*, B*, void*). If there's no operator==(A, B)
// available, then cmp_help_fun(A*, B*, void*) is the only
// candidate and thus decltype(cmp_help_fun(...)) is void.
template
<
class
A
,
typename
B
>
template
<
class
A
,
class
B
>
static
bool
cmp_help_fun
(
const
A
*
arg0
,
const
B
*
arg1
,
decltype
(
*
arg0
==
*
arg1
)
*
=
nullptr
);
decltype
(
*
arg0
==
*
arg1
)
*
,
std
::
integral_constant
<
bool
,
false
>
);
template
<
class
A
,
typename
B
>
static
void
cmp_help_fun
(
const
A
*
,
const
B
*
,
void
*
=
nullptr
);
// silences float-equal warnings caused by decltype(*arg0 == *arg1)
template
<
class
A
,
class
B
>
static
bool
cmp_help_fun
(
const
A
*
,
const
B
*
,
bool
*
,
std
::
integral_constant
<
bool
,
true
>
);
template
<
class
A
,
class
B
,
class
C
>
static
void
cmp_help_fun
(
const
A
*
,
const
B
*
,
void
*
,
C
);
using
result_type
=
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
bool
*>
(
nullptr
),
std
::
integral_constant
<
bool
,
std
::
is_arithmetic
<
T1
>::
value
&&
std
::
is_arithmetic
<
T2
>::
value
>
{}));
using
result_type
=
decltype
(
cmp_help_fun
(
static_cast
<
T1
*>
(
nullptr
),
static_cast
<
T2
*>
(
nullptr
),
static_cast
<
bool
*>
(
nullptr
)));
public:
static
constexpr
bool
value
=
std
::
is_same
<
bool
,
result_type
>::
value
;
};
...
...
libcaf_core/caf/policy/work_stealing.hpp
View file @
c077fbc0
...
...
@@ -140,8 +140,9 @@ public:
// dequeue attempts
auto
&
strategies
=
d
(
self
).
strategies
;
resumable
*
job
=
nullptr
;
for
(
int
k
=
0
;
k
<
2
;
++
k
)
{
// iterate over the first two strategies
for
(
size_t
i
=
0
;
i
<
strategies
[
k
].
attempts
;
i
+=
strategies
[
k
].
step_size
)
{
for
(
size_t
k
=
0
;
k
<
2
;
++
k
)
{
// iterate over the first two strategies
for
(
size_t
i
=
0
;
i
<
strategies
[
k
].
attempts
;
i
+=
strategies
[
k
].
step_size
)
{
job
=
d
(
self
).
queue
.
take_head
();
if
(
job
)
return
job
;
...
...
libcaf_core/caf/sum_type.hpp
View file @
c077fbc0
...
...
@@ -122,10 +122,10 @@ using sum_type_visit_result_t =
typename
sum_type_visit_result
<
detail
::
decay_t
<
F
>
,
detail
::
decay_t
<
Ts
>
...
>::
type
;
template
<
class
Result
,
in
t
I
,
class
Visitor
>
template
<
class
Result
,
size_
t
I
,
class
Visitor
>
struct
visit_impl_continuation
;
template
<
class
Result
,
in
t
I
>
template
<
class
Result
,
size_
t
I
>
struct
visit_impl
{
template
<
class
Visitor
,
class
T
,
class
...
Ts
>
static
Result
apply
(
Visitor
&&
f
,
T
&&
x
,
Ts
&&
...
xs
)
{
...
...
@@ -145,7 +145,7 @@ struct visit_impl<Result, 0> {
};
template
<
class
Result
,
in
t
I
,
class
Visitor
>
template
<
class
Result
,
size_
t
I
,
class
Visitor
>
struct
visit_impl_continuation
{
Visitor
&
f
;
template
<
class
...
Ts
>
...
...
libcaf_core/src/actor_system.cpp
View file @
c077fbc0
...
...
@@ -47,11 +47,6 @@ struct kvstate {
std
::
unordered_map
<
key_type
,
std
::
pair
<
mapped_type
,
subscriber_set
>>
data
;
std
::
unordered_map
<
strong_actor_ptr
,
topic_set
>
subscribers
;
static
const
char
*
name
;
template
<
class
Processor
>
friend
void
serialize
(
Processor
&
proc
,
kvstate
&
x
,
unsigned
int
)
{
proc
&
x
.
data
;
proc
&
x
.
subscribers
;
}
};
const
char
*
kvstate
::
name
=
"config_server"
;
...
...
libcaf_core/src/config_option_set.cpp
View file @
c077fbc0
...
...
@@ -177,8 +177,9 @@ auto config_option_set::parse(config_map& config, argument_iterator first,
if
(
opt
==
nullptr
)
return
{
pec
::
not_an_option
,
i
};
auto
code
=
consume
(
*
opt
,
assign_op
==
npos
?
i
->
end
()
:
i
->
begin
()
+
assign_op
+
1
,
assign_op
==
npos
?
i
->
end
()
:
i
->
begin
()
+
static_cast
<
ptrdiff_t
>
(
assign_op
+
1
),
i
->
end
());
if
(
code
!=
pec
::
success
)
return
{
code
,
i
};
...
...
libcaf_core/src/ipv4_address.cpp
View file @
c077fbc0
...
...
@@ -94,7 +94,8 @@ error parse(string_view str, ipv4_address& dest) {
parser
::
read_ipv4_address
(
res
,
f
);
if
(
res
.
code
==
pec
::
success
)
return
none
;
return
make_error
(
res
.
code
,
res
.
line
,
res
.
column
);
return
make_error
(
res
.
code
,
static_cast
<
size_t
>
(
res
.
line
),
static_cast
<
size_t
>
(
res
.
column
));
}
}
// namespace caf
libcaf_core/src/ipv6_address.cpp
View file @
c077fbc0
...
...
@@ -183,8 +183,8 @@ std::string to_string(ipv6_address x) {
// Output buffer.
std
::
string
result
;
// Utility for appending chunks to the result.
auto
add_chunk
=
[
&
](
uint16_t
x
)
{
append_v6_hex
(
result
,
reinterpret_cast
<
uint8_t
*>
(
&
x
));
auto
add_chunk
=
[
&
](
uint16_t
chunk
)
{
append_v6_hex
(
result
,
reinterpret_cast
<
uint8_t
*>
(
&
chunk
));
};
auto
add_chunks
=
[
&
](
u16_iterator
i
,
u16_iterator
e
)
{
if
(
i
!=
e
)
{
...
...
@@ -217,7 +217,8 @@ error parse(string_view str, ipv6_address& dest) {
parser
::
read_ipv6_address
(
res
,
f
);
if
(
res
.
code
==
pec
::
success
)
return
none
;
return
make_error
(
res
.
code
,
res
.
line
,
res
.
column
);
return
make_error
(
res
.
code
,
static_cast
<
size_t
>
(
res
.
line
),
static_cast
<
size_t
>
(
res
.
column
));
}
}
// namespace caf
libcaf_core/src/make_config_option.cpp
View file @
c077fbc0
...
...
@@ -104,15 +104,15 @@ meta_state ms_res_meta{
return
make_error
(
pec
::
type_mismatch
);
},
[](
void
*
ptr
,
const
config_value
&
x
)
{
*
static_cast
<
size_t
*>
(
ptr
)
=
get
<
timespan
>
(
x
).
count
()
/
1000000
;
*
static_cast
<
size_t
*>
(
ptr
)
=
static_cast
<
size_t
>
(
get
<
timespan
>
(
x
).
count
()
/
1000000
);
},
[](
const
void
*
ptr
)
->
config_value
{
auto
ival
=
static_cast
<
int64_t
>
(
*
static_cast
<
const
size_t
*>
(
ptr
));
timespan
val
{
ival
*
1000000
};
return
config_value
{
val
};
},
detail
::
type_name
<
timespan
>
()
};
detail
::
type_name
<
timespan
>
()};
}
// namespace
...
...
libcaf_core/src/scheduled_actor.cpp
View file @
c077fbc0
...
...
@@ -130,12 +130,12 @@ scheduled_actor::scheduled_actor(actor_config& cfg)
CAF_ASSERT
(
interval
.
count
()
>
0
);
stream_ticks_
.
interval
(
interval
);
CAF_ASSERT
(
sys_cfg
.
stream_max_batch_delay
.
count
()
>
0
);
max_batch_delay_ticks_
=
sys_cfg
.
stream_max_batch_delay
.
count
()
/
interval
.
count
();
auto
div
=
[](
timespan
x
,
timespan
y
)
{
return
static_cast
<
size_t
>
(
x
.
count
()
/
y
.
count
());
};
max_batch_delay_ticks_
=
div
(
sys_cfg
.
stream_max_batch_delay
,
interval
);
CAF_ASSERT
(
max_batch_delay_ticks_
>
0
);
CAF_ASSERT
(
sys_cfg
.
stream_credit_round_interval
.
count
()
>
0
);
credit_round_ticks_
=
sys_cfg
.
stream_credit_round_interval
.
count
()
/
interval
.
count
();
credit_round_ticks_
=
div
(
sys_cfg
.
stream_credit_round_interval
,
interval
);
CAF_ASSERT
(
credit_round_ticks_
>
0
);
CAF_LOG_DEBUG
(
CAF_ARG
(
interval
)
<<
CAF_ARG
(
max_batch_delay_ticks_
)
<<
CAF_ARG
(
credit_round_ticks_
));
...
...
libcaf_core/src/string_algorithms.cpp
View file @
c077fbc0
...
...
@@ -75,10 +75,11 @@ void replace_all(std::string& str, string_view what, string_view with) {
while
(
i
!=
str
.
end
())
{
auto
before
=
std
::
distance
(
str
.
begin
(),
i
);
CAF_ASSERT
(
before
>=
0
);
str
.
replace
(
i
,
i
+
what
.
size
(),
with
.
begin
(),
with
.
end
());
auto
ws
=
static_cast
<
decltype
(
before
)
>
(
what
.
size
());
str
.
replace
(
i
,
i
+
ws
,
with
.
begin
(),
with
.
end
());
// Iterator i became invalidated -> use new iterator pointing to the first
// character after the replaced text.
i
=
next
(
str
.
begin
()
+
before
+
w
ith
.
size
()
);
i
=
next
(
str
.
begin
()
+
before
+
w
s
);
}
}
...
...
libcaf_core/src/uri.cpp
View file @
c077fbc0
...
...
@@ -105,7 +105,8 @@ error parse(string_view str, uri& dest) {
dest
=
builder
.
make
();
return
none
;
}
return
make_error
(
res
.
code
,
res
.
line
,
res
.
column
);
return
make_error
(
res
.
code
,
static_cast
<
size_t
>
(
res
.
line
),
static_cast
<
size_t
>
(
res
.
column
));
}
}
// namespace caf
libcaf_core/src/uri_impl.cpp
View file @
c077fbc0
...
...
@@ -95,7 +95,7 @@ void uri_impl::add_encoded(string_view x, bool is_path) {
str
+=
ch
;
break
;
}
// fall through
CAF_ANNOTATE_FALLTHROUGH
;
case
' '
:
case
':'
:
case
'?'
:
...
...
libcaf_core/test/inbound_path.cpp
View file @
c077fbc0
...
...
@@ -30,12 +30,12 @@ using namespace caf;
namespace
{
template
<
class
...
Ts
>
void
print
(
const
char
*
format
,
Ts
...
xs
)
{
char
buf
[
200
];
snprintf
(
buf
,
200
,
format
,
xs
...);
CAF_MESSAGE
(
buf
);
}
#define PRINT(format, ...) \
{ \
char buf[200]; \
snprintf(buf, 200, format, __VA_ARGS__); \
CAF_MESSAGE(buf); \
}
struct
fixture
{
inbound_path
::
stats_t
x
;
...
...
@@ -53,11 +53,11 @@ struct fixture {
int32_t
t
=
total_time
;
int32_t
m
=
t
>
0
?
std
::
max
((
c
*
n
)
/
t
,
1
)
:
1
;
int32_t
b
=
t
>
0
?
std
::
max
((
d
*
n
)
/
t
,
1
)
:
1
;
print
(
"with a cycle C = %ldns, desied complexity D = %l
d,"
,
c
,
d
);
print
(
"number of items N = %ld, and time delta t = %l
d:"
,
n
,
t
);
print
(
"- throughput M = max(C * N / t, 1) = max(%ld * %ld / %ld, 1) = %l
d"
,
PRINT
(
"with a cycle C = %dns, desied complexity D = %
d,"
,
c
,
d
);
PRINT
(
"number of items N = %d, and time delta t = %
d:"
,
n
,
t
);
PRINT
(
"- throughput M = max(C * N / t, 1) = max(%d * %d / %d, 1) = %
d"
,
c
,
n
,
t
,
m
);
print
(
"- items/batch B = max(D * N / t, 1) = max(%ld * %ld / %ld, 1) = %l
d"
,
PRINT
(
"- items/batch B = max(D * N / t, 1) = max(%d * %d / %d, 1) = %
d"
,
d
,
n
,
t
,
b
);
auto
cr
=
x
.
calculate
(
timespan
(
c
),
timespan
(
d
));
CAF_CHECK_EQUAL
(
cr
.
items_per_batch
,
b
);
...
...
libcaf_core/test/streambuf.cpp
View file @
c077fbc0
...
...
@@ -131,11 +131,11 @@ CAF_TEST(containerbuf_reset_get_area) {
std
::
vector
<
char
>
buf
;
vectorbuf
vb
{
buf
};
// We can always write to the underlying buffer; no put area needed.
auto
n
=
vb
.
sputn
(
str
.
data
(),
st
r
.
size
(
));
auto
n
=
vb
.
sputn
(
str
.
data
(),
st
atic_cast
<
std
::
streamsize
>
(
str
.
size
()
));
CAF_REQUIRE_EQUAL
(
n
,
6
);
// Readjust the get area.
CAF_REQUIRE_EQUAL
(
buf
.
size
(),
6u
);
vb
.
pubsetbuf
(
buf
.
data
()
+
3
,
buf
.
size
()
-
3
);
vb
.
pubsetbuf
(
buf
.
data
()
+
3
,
static_cast
<
std
::
streamsize
>
(
buf
.
size
()
-
3
)
);
// Now read from a new get area into a buffer.
char
bar
[
3
];
n
=
vb
.
sgetn
(
bar
,
3
);
...
...
libcaf_core/test/sum_type.cpp
View file @
c077fbc0
...
...
@@ -34,13 +34,6 @@
namespace
{
struct
tostring_visitor
:
caf
::
static_visitor
<
std
::
string
>
{
template
<
class
T
>
inline
std
::
string
operator
()(
const
T
&
value
)
{
return
to_string
(
value
);
}
};
class
union_type
{
public:
friend
struct
caf
::
default_sum_type_access
<
union_type
>
;
...
...
@@ -59,11 +52,6 @@ public:
destroy
();
}
template
<
class
T
>
union_type
(
T
x
)
:
union_type
()
{
*
this
=
x
;
}
union_type
&
operator
=
(
T0
value
)
{
destroy
();
index_
=
0
;
...
...
libcaf_io/caf/io/network/receive_buffer.hpp
View file @
c077fbc0
...
...
@@ -184,7 +184,7 @@ public:
return
pos
;
auto
offset
=
static_cast
<
size_t
>
(
std
::
distance
(
begin
(),
pos
));
auto
old_size
=
size_
;
resize
(
old_size
+
n
);
resize
(
old_size
+
static_cast
<
size_t
>
(
n
)
);
pos
=
begin
()
+
offset
;
if
(
offset
!=
old_size
)
{
memmove
(
pos
+
n
,
pos
,
old_size
-
offset
);
...
...
libcaf_io/src/basp_broker.cpp
View file @
c077fbc0
...
...
@@ -52,16 +52,6 @@ struct seq_num_visitor {
basp_broker_state
*
state
;
};
struct
close_visitor
{
using
result_type
=
void
;
close_visitor
(
broker
*
ptr
)
:
b
(
ptr
)
{
}
template
<
class
T
>
result_type
operator
()(
const
T
&
hdl
)
{
b
->
close
(
hdl
);
}
broker
*
b
;
};
}
// namespace anonymous
const
char
*
basp_broker_state
::
name
=
"basp_broker"
;
...
...
libcaf_io/test/basp.cpp
View file @
c077fbc0
...
...
@@ -66,21 +66,6 @@ bool operator==(const maybe<T>& x, const T& y) {
return
x
.
val
?
x
.
val
==
y
:
true
;
}
template
<
class
T
>
bool
operator
==
(
const
T
&
x
,
const
maybe
<
T
>&
y
)
{
return
y
.
val
?
x
==
y
.
val
:
true
;
}
template
<
class
T
>
bool
operator
!=
(
const
maybe
<
T
>&
x
,
const
T
&
y
)
{
return
!
(
x
==
y
);
}
template
<
class
T
>
bool
operator
!=
(
const
T
&
x
,
const
maybe
<
T
>&
y
)
{
return
!
(
x
==
y
);
}
constexpr
uint8_t
no_flags
=
0
;
constexpr
uint32_t
no_payload
=
0
;
constexpr
uint64_t
no_operation_data
=
0
;
...
...
libcaf_io/test/basp_udp.cpp
View file @
c077fbc0
...
...
@@ -70,21 +70,6 @@ bool operator==(const maybe<T>& x, const T& y) {
return
x
.
val
?
x
.
val
==
y
:
true
;
}
template
<
class
T
>
bool
operator
==
(
const
T
&
x
,
const
maybe
<
T
>&
y
)
{
return
y
.
val
?
x
==
y
.
val
:
true
;
}
template
<
class
T
>
bool
operator
!=
(
const
maybe
<
T
>&
x
,
const
T
&
y
)
{
return
!
(
x
==
y
);
}
template
<
class
T
>
bool
operator
!=
(
const
T
&
x
,
const
maybe
<
T
>&
y
)
{
return
!
(
x
==
y
);
}
constexpr
uint8_t
no_flags
=
0
;
constexpr
uint32_t
no_payload
=
0
;
constexpr
uint64_t
no_operation_data
=
0
;
...
...
libcaf_openssl/src/manager.cpp
View file @
c077fbc0
...
...
@@ -39,45 +39,48 @@ CAF_POP_WARNINGS
#include "caf/openssl/middleman_actor.hpp"
#if OPENSSL_VERSION_NUMBER < 0x10100000L
struct
CRYPTO_dynlock_value
{
std
::
mutex
mtx
;
};
namespace
caf
{
namespace
openssl
{
namespace
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static
int
init_count
=
0
;
static
std
::
mutex
init_mutex
;
static
std
::
vector
<
std
::
mutex
>
mutexes
;
int
init_count
=
0
;
std
::
mutex
init_mutex
;
std
::
vector
<
std
::
mutex
>
mutexes
;
static
void
locking_function
(
int
mode
,
int
n
,
const
char
*
/* file */
,
int
/* line */
)
{
void
locking_function
(
int
mode
,
int
n
,
const
char
*
,
int
)
{
if
(
mode
&
CRYPTO_LOCK
)
mutexes
[
n
].
lock
();
mutexes
[
static_cast
<
size_t
>
(
n
)
].
lock
();
else
mutexes
[
n
].
unlock
();
mutexes
[
static_cast
<
size_t
>
(
n
)
].
unlock
();
}
static
CRYPTO_dynlock_value
*
dynlock_create
(
const
char
*
/* file */
,
int
/* line */
)
{
return
new
CRYPTO_dynlock_value
{};
CRYPTO_dynlock_value
*
dynlock_create
(
const
char
*
,
int
)
{
return
new
CRYPTO_dynlock_value
;
}
static
void
dynlock_lock
(
int
mode
,
CRYPTO_dynlock_value
*
dynlock
,
const
char
*
/* file */
,
int
/* line */
)
{
void
dynlock_lock
(
int
mode
,
CRYPTO_dynlock_value
*
dynlock
,
const
char
*
,
int
)
{
if
(
mode
&
CRYPTO_LOCK
)
dynlock
->
mtx
.
lock
();
else
dynlock
->
mtx
.
unlock
();
}
static
void
dynlock_destroy
(
CRYPTO_dynlock_value
*
dynlock
,
const
char
*
/* file */
,
int
/* line */
)
{
void
dynlock_destroy
(
CRYPTO_dynlock_value
*
dynlock
,
const
char
*
,
int
)
{
delete
dynlock
;
}
}
// namespace <anonymous>
#endif
namespace
caf
{
namespace
openssl
{
manager
::~
manager
()
{
#if OPENSSL_VERSION_NUMBER < 0x10100000L
std
::
lock_guard
<
std
::
mutex
>
lock
{
init_mutex
};
...
...
@@ -119,12 +122,11 @@ void manager::init(actor_system_config&) {
if
(
system
().
config
().
openssl_key
.
size
()
==
0
)
CAF_RAISE_ERROR
(
"No private key configured for SSL endpoint"
);
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
std
::
lock_guard
<
std
::
mutex
>
lock
{
init_mutex
};
++
init_count
;
if
(
init_count
==
1
)
{
mutexes
=
std
::
vector
<
std
::
mutex
>
(
CRYPTO_num_locks
())
;
mutexes
=
std
::
vector
<
std
::
mutex
>
{
static_cast
<
size_t
>
(
CRYPTO_num_locks
())}
;
CRYPTO_set_locking_callback
(
locking_function
);
CRYPTO_set_dynlock_create_callback
(
dynlock_create
);
CRYPTO_set_dynlock_lock_callback
(
dynlock_lock
);
...
...
libcaf_openssl/src/middleman_actor.cpp
View file @
c077fbc0
...
...
@@ -109,7 +109,7 @@ class scribe_impl : public io::scribe {
// nop
}
~
scribe_impl
()
{
~
scribe_impl
()
override
{
CAF_LOG_TRACE
(
""
);
}
...
...
tools/caf-run.cpp
View file @
c077fbc0
...
...
@@ -244,6 +244,8 @@ void bootstrap(actor_system& system,
return 1; \
} while (true)
namespace
{
struct
config
:
actor_system_config
{
config
()
{
opt_group
{
custom_options_
,
"global"
}
...
...
@@ -254,6 +256,8 @@ struct config : actor_system_config {
string
wdir
;
};
}
// namespace <anonymous>
int
main
(
int
argc
,
char
**
argv
)
{
config
cfg
;
cfg
.
parse
(
argc
,
argv
);
...
...
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