Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
240bb073
Commit
240bb073
authored
Sep 21, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate review feedback
parent
fb51d49b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
24 deletions
+15
-24
libcaf_net/caf/net/socket.hpp
libcaf_net/caf/net/socket.hpp
+10
-24
libcaf_net/caf/net/socket_id.hpp
libcaf_net/caf/net/socket_id.hpp
+5
-0
No files found.
libcaf_net/caf/net/socket.hpp
View file @
240bb073
...
...
@@ -23,6 +23,7 @@
#include <type_traits>
#include "caf/config.hpp"
#include "caf/detail/comparable.hpp"
#include "caf/fwd.hpp"
#include "caf/net/socket_id.hpp"
...
...
@@ -31,24 +32,24 @@ namespace net {
/// An internal endpoint for sending or receiving data. Can be either a
/// ::network_socket, ::pipe_socket, ::stream_socket, or ::datagram_socket.
struct
socket
{
struct
socket
:
detail
::
comparable
<
socket
>
{
socket_id
id
;
constexpr
socket
()
:
id
(
invalid_socket_id
)
{
constexpr
socket
()
noexcept
:
id
(
invalid_socket_id
)
{
// nop
}
constexpr
explicit
socket
(
socket_id
id
)
:
id
(
id
)
{
constexpr
explicit
socket
(
socket_id
id
)
noexcept
:
id
(
id
)
{
// nop
}
constexpr
socket
(
const
socket
&
other
)
:
id
(
other
.
id
)
{
// nop
}
constexpr
socket
(
const
socket
&
other
)
noexcept
=
default
;
socket
&
operator
=
(
const
socket
&
other
)
noexcept
=
default
;
socket
&
operator
=
(
const
socket
&
other
)
{
id
=
other
.
id
;
return
*
this
;
constexpr
signed_socket_id
compare
(
socket
other
)
const
noexcept
{
return
static_cast
<
signed_socket_id
>
(
id
)
-
static_cast
<
signed_socket_id
>
(
other
.
id
)
;
}
};
...
...
@@ -58,21 +59,6 @@ typename Inspector::result_type inspect(Inspector& f, socket& x) {
return
f
(
x
.
id
);
}
/// @relates socket
constexpr
bool
operator
==
(
socket
x
,
socket
y
)
{
return
x
.
id
==
y
.
id
;
}
/// @relates socket
constexpr
bool
operator
!=
(
socket
x
,
socket
y
)
{
return
x
.
id
!=
y
.
id
;
}
/// @relates socket
constexpr
bool
operator
<
(
socket
x
,
socket
y
)
{
return
x
.
id
<
y
.
id
;
}
/// Denotes the invalid socket.
constexpr
auto
invalid_socket
=
socket
{
invalid_socket_id
};
...
...
libcaf_net/caf/net/socket_id.hpp
View file @
240bb073
...
...
@@ -20,6 +20,7 @@
#include <cstddef>
#include <limits>
#include <type_traits>
#include "caf/config.hpp"
...
...
@@ -46,5 +47,9 @@ constexpr socket_id invalid_socket_id = -1;
#endif // CAF_WINDOWS
/// Signed counterpart of `socket_id`.
/// @relates socket
using
signed_socket_id
=
std
::
make_signed
<
socket_id
>::
type
;
}
// namespace net
}
// namespace caf
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