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
2c95a660
Unverified
Commit
2c95a660
authored
Jan 10, 2018
by
Dominik Charousset
Committed by
GitHub
Jan 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #648
Fix UDP unit tests on Windows
parents
5af618ff
b949a591
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
5 deletions
+33
-5
libcaf_io/caf/io/network/default_multiplexer.hpp
libcaf_io/caf/io/network/default_multiplexer.hpp
+3
-0
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+19
-1
libcaf_io/test/ip_endpoint.cpp
libcaf_io/test/ip_endpoint.cpp
+11
-4
No files found.
libcaf_io/caf/io/network/default_multiplexer.hpp
View file @
2c95a660
...
...
@@ -184,6 +184,9 @@ expected<void> tcp_nodelay(native_socket fd, bool new_value);
/// Enables or disables `SIGPIPE` events from `fd`.
expected
<
void
>
allow_sigpipe
(
native_socket
fd
,
bool
new_value
);
/// Enables or disables `SIO_UDP_CONNRESET`error on `fd`.
expected
<
void
>
allow_udp_connreset
(
native_socket
fd
,
bool
new_value
);
/// Get the socket buffer size for `fd`.
expected
<
int
>
send_buffer_size
(
native_socket
fd
);
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
2c95a660
...
...
@@ -87,8 +87,8 @@ bool cc_valid_socket(caf::io::network::native_socket fd) {
return make_error(sec::network_syscall_failed, \
fun_name, last_socket_error_as_string())
// calls a C functions and calls exit() if `predicate(var)` returns false
#ifdef CAF_WINDOWS
// calls a C functions and calls exit() if `predicate(var)` returns false
#define CALL_CRITICAL_CFUN(var, predicate, funname, expr) \
auto var = expr; \
if (!predicate(var)) { \
...
...
@@ -96,6 +96,10 @@ bool cc_valid_socket(caf::io::network::native_socket fd) {
__FILE__, __LINE__, funname, last_socket_error_as_string().c_str());\
abort(); \
} static_cast<void>(0)
#ifndef SIO_UDP_CONNRESET
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR, 12)
#endif
#endif // CAF_WINDOWS
}
// namespace <anonymous>
...
...
@@ -132,6 +136,11 @@ namespace network {
return
unit
;
}
expected
<
void
>
allow_udp_connreset
(
native_socket
,
bool
)
{
// nop; SIO_UDP_CONNRESET only exists on Windows
return
unit
;
}
std
::
pair
<
native_socket
,
native_socket
>
create_pipe
()
{
int
pipefds
[
2
];
if
(
pipe
(
pipefds
)
!=
0
)
{
...
...
@@ -178,6 +187,14 @@ namespace network {
return
unit
;
}
expected
<
void
>
allow_udp_connreset
(
native_socket
fd
,
bool
new_value
)
{
DWORD
bytes_returned
=
0
;
CALL_CFUN
(
res
,
cc_zero
,
"WSAIoctl"
,
WSAIoctl
(
fd
,
SIO_UDP_CONNRESET
,
&
new_value
,
sizeof
(
new_value
),
NULL
,
0
,
&
bytes_returned
,
NULL
,
NULL
));
return
unit
;
}
/**************************************************************************\
* Based on work of others; *
* original header: *
...
...
@@ -1192,6 +1209,7 @@ datagram_handler::datagram_handler(default_multiplexer& backend_ref,
send_buffer_size_
(
0
),
ack_writes_
(
false
),
writing_
(
false
)
{
allow_udp_connreset
(
sockfd
,
false
);
auto
es
=
send_buffer_size
(
sockfd
);
if
(
!
es
)
CAF_LOG_ERROR
(
"cannot determine socket buffer size"
);
...
...
libcaf_io/test/ip_endpoint.cpp
View file @
2c95a660
...
...
@@ -25,19 +25,26 @@
#include "caf/actor_system.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/binary_serializer.hpp"
#include "caf/binary_deserializer.hpp"
#include "caf/io/middleman.hpp"
#include "caf/io/network/interfaces.hpp"
#include "caf/io/network/ip_endpoint.hpp"
using
namespace
caf
;
using
namespace
caf
::
io
;
namespace
{
class
config
:
public
actor_system_config
{
public:
config
()
{
// this will call WSAStartup for network initialization on Windows
load
<
io
::
middleman
>
();
}
};
struct
fixture
{
template
<
class
T
,
class
...
Ts
>
...
...
@@ -54,11 +61,11 @@ void deserialize(const std::vector<char>& buf, T& x, Ts&... xs) {
bd
(
x
,
xs
...);
}
fixture
()
:
system
(
cfg
),
context
(
&
system
)
{
fixture
()
:
cfg
(),
system
(
cfg
),
context
(
&
system
)
{
}
actor_system_
config
cfg
;
config
cfg
;
actor_system
system
;
scoped_execution_unit
context
;
...
...
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