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
bd5935ce
Commit
bd5935ce
authored
Mar 05, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `new_tcp_connection_impl` for IPv6
parent
3385553b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+3
-3
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+15
-5
No files found.
libcaf_io/src/basp_broker.cpp
View file @
bd5935ce
...
...
@@ -186,10 +186,10 @@ behavior basp_broker::make_behavior() {
try
{
assign_tcp_scribe
(
hdl
);
}
catch
(
...
)
{
CAF_LOG_DEBUG
(
"failed to assign scribe from handle
"
);
catch
(
std
::
exception
&
e
)
{
CAF_LOG_DEBUG
(
"failed to assign scribe from handle
: "
<<
e
.
what
()
);
send
(
client
,
error_atom
::
value
,
request_id
,
"failed to assign scribe from handle"
);
std
::
string
(
"failed to assign scribe from handle: "
)
+
e
.
what
()
);
return
;
}
auto
&
ctx
=
m_ctx
[
hdl
];
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
bd5935ce
...
...
@@ -113,6 +113,7 @@ namespace network {
}
void
nonblocking
(
native_socket
fd
,
bool
new_value
)
{
CAF_LOGF_TRACE
(
CAF_ARG
(
fd
)
<<
", "
<<
CAF_ARG
(
new_value
));
// read flags for fd
auto
rf
=
ccall
(
cc_not_minus1
,
"cannot read flags"
,
fcntl
,
fd
,
F_GETFL
,
0
);
// calculate and set new flags
...
...
@@ -864,6 +865,7 @@ default_multiplexer::add_tcp_doorman(broker* self, uint16_t port,
******************************************************************************/
void
tcp_nodelay
(
native_socket
fd
,
bool
new_value
)
{
CAF_LOGF_TRACE
(
CAF_ARG
(
fd
)
<<
", "
<<
CAF_ARG
(
new_value
));
int
flag
=
new_value
?
1
:
0
;
ccall
(
cc_zero
,
"unable to set TCP_NODELAY"
,
setsockopt
,
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
reinterpret_cast
<
setsockopt_ptr
>
(
&
flag
),
...
...
@@ -965,7 +967,7 @@ default_socket::~default_socket() {
void
default_socket
::
close_read
()
{
if
(
m_fd
!=
invalid_native_socket
)
{
::
shutdown
(
m_fd
,
0
);
// 0 identif
y
ies the read channel on Win & UNIX
::
shutdown
(
m_fd
,
0
);
// 0 identifies the read channel on Win & UNIX
}
}
...
...
@@ -976,8 +978,7 @@ class socket_guard {
}
~
socket_guard
()
{
if
(
m_fd
!=
invalid_native_socket
)
closesocket
(
m_fd
);
close
();
}
native_socket
release
()
{
...
...
@@ -986,6 +987,13 @@ class socket_guard {
return
fd
;
}
void
close
()
{
if
(
m_fd
!=
invalid_native_socket
)
{
closesocket
(
m_fd
);
m_fd
=
invalid_native_socket
;
}
}
private:
native_socket
m_fd
;
};
...
...
@@ -1066,9 +1074,10 @@ native_socket new_tcp_connection_impl(const std::string& host, uint16_t port,
socket_guard
sguard
(
fd
);
if
(
proto
==
ipv6
)
{
if
(
ip_connect
<
AF_INET6
>
(
fd
,
res
->
first
,
port
))
{
CAF_LOGF_INFO
(
"successfully connected to host"
);
return
fd
;
CAF_LOGF_INFO
(
"successfully connected to host
via IPv6
"
);
return
sguard
.
release
()
;
}
sguard
.
close
();
// IPv4 fallback
return
new_tcp_connection_impl
(
host
,
port
,
ipv4
);
}
...
...
@@ -1076,6 +1085,7 @@ native_socket new_tcp_connection_impl(const std::string& host, uint16_t port,
CAF_LOGF_ERROR
(
"could not connect to to "
<<
host
<<
" on port "
<<
port
);
throw
network_error
(
"could not connect to "
+
host
);
}
CAF_LOGF_INFO
(
"successfully connected to host via IPv4"
);
return
sguard
.
release
();
}
...
...
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