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
b4416deb
Unverified
Commit
b4416deb
authored
May 20, 2023
by
Raphael
Committed by
GitHub
May 20, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1414
Prefer CAF's own print over snprintf
parents
28461e75
b0ec89ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
libcaf_io/src/io/network/interfaces.cpp
libcaf_io/src/io/network/interfaces.cpp
+4
-6
No files found.
libcaf_io/src/io/network/interfaces.cpp
View file @
b4416deb
...
...
@@ -36,6 +36,7 @@
#include <utility>
#include "caf/detail/get_mac_addresses.hpp"
#include "caf/detail/print.hpp"
#include "caf/io/network/ip_endpoint.hpp"
#include "caf/raise_error.hpp"
...
...
@@ -262,14 +263,11 @@ interfaces::server_address(uint16_t port, const char* host,
bool
interfaces
::
get_endpoint
(
const
std
::
string
&
host
,
uint16_t
port
,
ip_endpoint
&
ep
,
std
::
optional
<
protocol
::
network
>
preferred
)
{
static_assert
(
sizeof
(
uint16_t
)
==
sizeof
(
unsigned
short
int
),
"uint16_t cannot be printed with %hu in snprintf"
);
addrinfo
hint
;
// max port is 2^16 which needs 5 characters plus null terminator
char
port_hint
[
6
];
snprintf
(
port_hint
,
sizeof
(
port_hint
),
"%hu"
,
port
);
memset
(
&
hint
,
0
,
sizeof
(
hint
));
hint
.
ai_socktype
=
SOCK_DGRAM
;
std
::
string
port_hint
;
detail
::
print
(
port_hint
,
port
);
if
(
preferred
)
hint
.
ai_family
=
*
preferred
==
protocol
::
network
::
ipv4
?
AF_INET
:
AF_INET6
;
#ifdef AI_V4MAPPED
...
...
@@ -277,7 +275,7 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port,
hint
.
ai_flags
=
AI_V4MAPPED
;
#endif
addrinfo
*
tmp
=
nullptr
;
if
(
getaddrinfo
(
host
.
c_str
(),
port_hint
,
&
hint
,
&
tmp
)
!=
0
)
if
(
getaddrinfo
(
host
.
c_str
(),
port_hint
.
c_str
()
,
&
hint
,
&
tmp
)
!=
0
)
return
false
;
std
::
unique_ptr
<
addrinfo
,
decltype
(
freeaddrinfo
)
*>
addrs
{
tmp
,
freeaddrinfo
};
for
(
auto
i
=
addrs
.
get
();
i
!=
nullptr
;
i
=
i
->
ai_next
)
{
...
...
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