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
80d1dd81
Commit
80d1dd81
authored
Jul 11, 2018
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove socket includes from default mpx header
parent
180bab00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
27 deletions
+56
-27
libcaf_io/caf/io/network/default_multiplexer.hpp
libcaf_io/caf/io/network/default_multiplexer.hpp
+9
-18
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+47
-9
No files found.
libcaf_io/caf/io/network/default_multiplexer.hpp
View file @
80d1dd81
...
...
@@ -57,40 +57,31 @@
# ifndef CAF_WINDOWS
# include <poll.h>
# endif
# ifndef POLLRDHUP
# define POLLRDHUP POLLHUP
# endif
# ifndef POLLPRI
# define POLLPRI POLLIN
# endif
#else
# define CAF_EPOLL_MULTIPLEXER
# include <sys/epoll.h>
#endif
// Forward declaration for Windows.
struct
pollfd
;
namespace
caf
{
namespace
io
{
namespace
network
{
// poll vs epoll backend
#if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer
# ifdef CAF_WINDOWS
// From the MSDN: If the POLLPRI flag is set on a socket for the Microsoft
// Winsock provider, the WSAPoll function will fail.
constexpr
short
input_mask
=
POLLIN
;
# else
constexpr
short
input_mask
=
POLLIN
|
POLLPRI
;
# endif
constexpr
short
error_mask
=
POLLRDHUP
|
POLLERR
|
POLLHUP
|
POLLNVAL
;
constexpr
short
output_mask
=
POLLOUT
;
extern
const
short
input_mask
;
extern
const
short
error_mask
;
extern
const
short
output_mask
;
class
event_handler
;
using
multiplexer_data
=
pollfd
;
using
multiplexer_poll_shadow_data
=
std
::
vector
<
event_handler
*>
;
#else
# define CAF_EPOLL_MULTIPLEXER
constexpr
int
input_mask
=
EPOLLIN
;
constexpr
int
error_mask
=
EPOLLRDHUP
|
EPOLLERR
|
EPOLLHUP
;
constexpr
int
output_mask
=
EPOLLOUT
;
extern
const
int
input_mask
;
extern
const
int
error_mask
;
extern
const
int
output_mask
;
using
multiplexer_data
=
epoll_event
;
using
multiplexer_poll_shadow_data
=
native_socket
;
#endif
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
80d1dd81
...
...
@@ -38,21 +38,35 @@
#include "caf/scheduler/abstract_coordinator.hpp"
#ifdef CAF_WINDOWS
# include <winsock2.h>
# include <ws2tcpip.h> // socket_size_type, etc. (MSVC20xx)
# include <windows.h>
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif // WIN32_LEAN_AND_MEAN
# ifndef NOMINMAX
# define NOMINMAX
# endif
# ifdef CAF_MINGW
# undef _WIN32_WINNT
# undef WINVER
# define _WIN32_WINNT WindowsVista
# define WINVER WindowsVista
# include <w32api.h>
# endif
# include <io.h>
# include <unistd.h>
# include <windows.h>
# include <winsock2.h>
# include <ws2ipdef.h>
# include <ws2tcpip.h>
#else
# include <cerrno>
# include <netdb.h>
# include <fcntl.h>
# include <unistd.h>
# include <sys/types.h>
# include <arpa/inet.h>
# include <sys/socket.h>
# include <cerrno>
# include <fcntl.h>
# include <netdb.h>
# include <netinet/in.h>
# include <netinet/ip.h>
# include <netinet/tcp.h>
# include <sys/socket.h>
# include <sys/types.h>
# include <utility>
#endif
...
...
@@ -94,6 +108,30 @@ namespace caf {
namespace
io
{
namespace
network
{
// poll vs epoll backend
#if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer
# ifndef POLLRDHUP
# define POLLRDHUP POLLHUP
# endif
# ifndef POLLPRI
# define POLLPRI POLLIN
# endif
# ifdef CAF_WINDOWS
// From the MSDN: If the POLLPRI flag is set on a socket for the Microsoft
// Winsock provider, the WSAPoll function will fail.
const
short
input_mask
=
POLLIN
;
# else
const
short
input_mask
=
POLLIN
|
POLLPRI
;
# endif
const
short
error_mask
=
POLLRDHUP
|
POLLERR
|
POLLHUP
|
POLLNVAL
;
const
short
output_mask
=
POLLOUT
;
#else
# define CAF_EPOLL_MULTIPLEXER
const
int
input_mask
=
EPOLLIN
;
const
int
error_mask
=
EPOLLRDHUP
|
EPOLLERR
|
EPOLLHUP
;
const
int
output_mask
=
EPOLLOUT
;
#endif
// -- Platform-dependent abstraction over epoll() or poll() --------------------
#ifdef CAF_EPOLL_MULTIPLEXER
...
...
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