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
244fffa6
Commit
244fffa6
authored
May 24, 2017
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix agnostic socket handling on windows
parent
cf0e7e2c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+10
-10
No files found.
libcaf_io/src/default_multiplexer.cpp
View file @
244fffa6
...
@@ -1317,7 +1317,7 @@ expected<void> set_inaddr_any(native_socket fd, sockaddr_in6& sa) {
...
@@ -1317,7 +1317,7 @@ expected<void> set_inaddr_any(native_socket fd, sockaddr_in6& sa) {
template
<
int
Family
>
template
<
int
Family
>
expected
<
native_socket
>
new_ip_acceptor_impl
(
uint16_t
port
,
const
char
*
addr
,
expected
<
native_socket
>
new_ip_acceptor_impl
(
uint16_t
port
,
const
char
*
addr
,
bool
reuse_addr
)
{
bool
reuse_addr
,
bool
any
)
{
static_assert
(
Family
==
AF_INET
||
Family
==
AF_INET6
,
"invalid family"
);
static_assert
(
Family
==
AF_INET
||
Family
==
AF_INET6
,
"invalid family"
);
CAF_LOG_TRACE
(
CAF_ARG
(
port
)
<<
", addr = "
<<
(
addr
?
addr
:
"nullptr"
));
CAF_LOG_TRACE
(
CAF_ARG
(
port
)
<<
", addr = "
<<
(
addr
?
addr
:
"nullptr"
));
CALL_CFUN
(
fd
,
cc_valid_socket
,
"socket"
,
socket
(
Family
,
SOCK_STREAM
,
0
));
CALL_CFUN
(
fd
,
cc_valid_socket
,
"socket"
,
socket
(
Family
,
SOCK_STREAM
,
0
));
...
@@ -1339,12 +1339,10 @@ expected<native_socket> new_ip_acceptor_impl(uint16_t port, const char* addr,
...
@@ -1339,12 +1339,10 @@ expected<native_socket> new_ip_acceptor_impl(uint16_t port, const char* addr,
sockaddr_type
sa
;
sockaddr_type
sa
;
memset
(
&
sa
,
0
,
sizeof
(
sockaddr_type
));
memset
(
&
sa
,
0
,
sizeof
(
sockaddr_type
));
family_of
(
sa
)
=
Family
;
family_of
(
sa
)
=
Family
;
if
(
!
addr
)
{
if
(
any
)
set_inaddr_any
(
fd
,
sa
);
set_inaddr_any
(
fd
,
sa
);
}
else
{
CALL_CFUN
(
tmp
,
cc_one
,
"inet_pton"
,
CALL_CFUN
(
res
,
cc_one
,
"inet_pton"
,
inet_pton
(
Family
,
addr
,
&
addr_of
(
sa
)));
inet_pton
(
Family
,
addr
,
&
addr_of
(
sa
)));
}
port_of
(
sa
)
=
htons
(
port
);
port_of
(
sa
)
=
htons
(
port
);
CALL_CFUN
(
res
,
cc_zero
,
"bind"
,
CALL_CFUN
(
res
,
cc_zero
,
"bind"
,
bind
(
fd
,
reinterpret_cast
<
sockaddr
*>
(
&
sa
),
bind
(
fd
,
reinterpret_cast
<
sockaddr
*>
(
&
sa
),
...
@@ -1359,12 +1357,14 @@ expected<native_socket> new_tcp_acceptor_impl(uint16_t port, const char* addr,
...
@@ -1359,12 +1357,14 @@ expected<native_socket> new_tcp_acceptor_impl(uint16_t port, const char* addr,
if
(
addrs
.
empty
())
if
(
addrs
.
empty
())
return
make_error
(
sec
::
cannot_open_port
,
"No local interface available"
,
return
make_error
(
sec
::
cannot_open_port
,
"No local interface available"
,
addr
);
addr
);
int
fd
=
invalid_native_socket
;
auto
addr_str
=
std
::
string
{
addr
==
nullptr
?
""
:
addr
};
bool
any
=
addr_str
.
empty
()
||
addr_str
==
"::"
||
addr_str
==
"0.0.0.0"
;
auto
fd
=
invalid_native_socket
;
for
(
auto
&
elem
:
addrs
)
{
for
(
auto
&
elem
:
addrs
)
{
auto
addr
=
elem
.
first
.
c_str
();
auto
hostname
=
elem
.
first
.
c_str
();
auto
p
=
elem
.
second
==
ipv4
auto
p
=
elem
.
second
==
ipv4
?
new_ip_acceptor_impl
<
AF_INET
>
(
port
,
addr
,
reuse_addr
)
?
new_ip_acceptor_impl
<
AF_INET
>
(
port
,
hostname
,
reuse_addr
,
any
)
:
new_ip_acceptor_impl
<
AF_INET6
>
(
port
,
addr
,
reuse_addr
);
:
new_ip_acceptor_impl
<
AF_INET6
>
(
port
,
hostname
,
reuse_addr
,
any
);
if
(
!
p
)
{
if
(
!
p
)
{
CAF_LOG_DEBUG
(
p
.
error
());
CAF_LOG_DEBUG
(
p
.
error
());
continue
;
continue
;
...
...
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