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
72eb7b70
Unverified
Commit
72eb7b70
authored
Jun 21, 2019
by
Dominik Charousset
Committed by
GitHub
Jun 21, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #850
Set SO_KEEPALIVE on TCP connections
parents
40e7b16e
fc3e5317
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
libcaf_io/caf/io/network/native_socket.hpp
libcaf_io/caf/io/network/native_socket.hpp
+3
-0
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+1
-0
libcaf_io/src/native_socket.cpp
libcaf_io/src/native_socket.cpp
+18
-0
No files found.
libcaf_io/caf/io/network/native_socket.hpp
View file @
72eb7b70
...
@@ -91,6 +91,9 @@ std::pair<native_socket, native_socket> create_pipe();
...
@@ -91,6 +91,9 @@ std::pair<native_socket, native_socket> create_pipe();
/// throws `network_error` on error
/// throws `network_error` on error
expected
<
void
>
child_process_inherit
(
native_socket
fd
,
bool
new_value
);
expected
<
void
>
child_process_inherit
(
native_socket
fd
,
bool
new_value
);
/// Enables keepalive on `fd`. Throws `network_error` on error.
expected
<
void
>
keepalive
(
native_socket
fd
,
bool
new_value
);
/// Sets fd to nonblocking if `set_nonblocking == true`
/// Sets fd to nonblocking if `set_nonblocking == true`
/// or to blocking if `set_nonblocking == false`
/// or to blocking if `set_nonblocking == false`
/// throws `network_error` on error
/// throws `network_error` on error
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
72eb7b70
...
@@ -672,6 +672,7 @@ void default_multiplexer::exec_later(resumable* ptr) {
...
@@ -672,6 +672,7 @@ void default_multiplexer::exec_later(resumable* ptr) {
scribe_ptr
default_multiplexer
::
new_scribe
(
native_socket
fd
)
{
scribe_ptr
default_multiplexer
::
new_scribe
(
native_socket
fd
)
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
keepalive
(
fd
,
true
);
return
make_counted
<
scribe_impl
>
(
*
this
,
fd
);
return
make_counted
<
scribe_impl
>
(
*
this
,
fd
);
}
}
...
...
libcaf_io/src/native_socket.cpp
View file @
72eb7b70
...
@@ -140,6 +140,15 @@ namespace network {
...
@@ -140,6 +140,15 @@ namespace network {
return
unit
;
return
unit
;
}
}
expected
<
void
>
keepalive
(
native_socket
fd
,
bool
new_value
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
)
<<
CAF_ARG
(
new_value
));
int
value
=
new_value
?
1
:
0
;
CALL_CFUN
(
res
,
detail
::
cc_zero
,
"setsockopt"
,
setsockopt
(
fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
&
value
,
static_cast
<
unsigned
>
(
sizeof
(
value
))));
return
unit
;
}
expected
<
void
>
nonblocking
(
native_socket
fd
,
bool
new_value
)
{
expected
<
void
>
nonblocking
(
native_socket
fd
,
bool
new_value
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
)
<<
CAF_ARG
(
new_value
));
CAF_LOG_TRACE
(
CAF_ARG
(
fd
)
<<
CAF_ARG
(
new_value
));
// read flags for fd
// read flags for fd
...
@@ -223,6 +232,15 @@ namespace network {
...
@@ -223,6 +232,15 @@ namespace network {
return
unit
;
return
unit
;
}
}
expected
<
void
>
keepalive
(
native_socket
fd
,
bool
new_value
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
)
<<
CAF_ARG
(
new_value
));
char
value
=
new_value
?
1
:
0
;
CALL_CFUN
(
res
,
detail
::
cc_zero
,
"setsockopt"
,
setsockopt
(
fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
&
value
,
static_cast
<
int
>
(
sizeof
(
value
))));
return
unit
;
}
expected
<
void
>
nonblocking
(
native_socket
fd
,
bool
new_value
)
{
expected
<
void
>
nonblocking
(
native_socket
fd
,
bool
new_value
)
{
u_long
mode
=
new_value
?
1
:
0
;
u_long
mode
=
new_value
?
1
:
0
;
CALL_CFUN
(
res
,
detail
::
cc_zero
,
"ioctlsocket"
,
CALL_CFUN
(
res
,
detail
::
cc_zero
,
"ioctlsocket"
,
...
...
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