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
e6f83819
Commit
e6f83819
authored
Dec 02, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split accept_socket and doorman tests
parent
03713e97
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
13 deletions
+68
-13
libcaf_net/test/accept_socket.cpp
libcaf_net/test/accept_socket.cpp
+68
-0
libcaf_net/test/doorman.cpp
libcaf_net/test/doorman.cpp
+0
-13
No files found.
libcaf_net/test/accept_socket.cpp
0 → 100644
View file @
e6f83819
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2019 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#define CAF_SUITE net.tcp_accept_socket
#include "caf/net/tcp_accept_socket.hpp"
#include "caf/binary_serializer.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/ip.hpp"
#include "caf/net/make_endpoint_manager.hpp"
#include "caf/net/multiplexer.hpp"
#include "caf/net/socket_guard.hpp"
#include "caf/net/tcp_stream_socket.hpp"
#include "caf/uri.hpp"
#include "caf/test/dsl.hpp"
#include "caf/net/test/host_fixture.hpp"
using
namespace
caf
;
using
namespace
caf
::
net
;
using
namespace
std
::
literals
::
string_literals
;
namespace
{
struct
fixture
:
test_coordinator_fixture
<>
,
host_fixture
{
fixture
()
{
auth
.
port
=
0
;
auth
.
host
=
"0.0.0.0"
s
;
}
uri
::
authority_type
auth
;
};
}
// namespace
CAF_TEST_FIXTURE_SCOPE
(
doorman_tests
,
fixture
)
CAF_TEST
(
tcp
connect
)
{
auto
acceptor
=
unbox
(
make_tcp_accept_socket
(
auth
,
false
));
auto
port
=
unbox
(
local_port
(
socket_cast
<
network_socket
>
(
acceptor
)));
auto
acceptor_guard
=
make_socket_guard
(
acceptor
);
CAF_MESSAGE
(
"opened acceptor on port "
<<
port
);
uri
::
authority_type
dst
;
dst
.
port
=
port
;
dst
.
host
=
"localhost"
s
;
auto
conn
=
make_socket_guard
(
unbox
(
make_connected_tcp_stream_socket
(
dst
)));
auto
accepted
=
make_socket_guard
(
unbox
(
accept
(
acceptor
)));
CAF_MESSAGE
(
"accepted connection"
);
}
CAF_TEST_FIXTURE_SCOPE_END
()
libcaf_net/test/doorman.cpp
View file @
e6f83819
...
...
@@ -135,19 +135,6 @@ public:
CAF_TEST_FIXTURE_SCOPE
(
doorman_tests
,
fixture
)
CAF_TEST
(
tcp
connect
)
{
auto
acceptor
=
unbox
(
make_tcp_accept_socket
(
auth
,
false
));
auto
port
=
unbox
(
local_port
(
socket_cast
<
network_socket
>
(
acceptor
)));
auto
acceptor_guard
=
make_socket_guard
(
acceptor
);
CAF_MESSAGE
(
"opened acceptor on port "
<<
port
);
uri
::
authority_type
dst
;
dst
.
port
=
port
;
dst
.
host
=
"localhost"
s
;
auto
conn
=
make_socket_guard
(
unbox
(
make_connected_tcp_stream_socket
(
dst
)));
auto
accepted
=
make_socket_guard
(
unbox
(
accept
(
acceptor
)));
CAF_MESSAGE
(
"accepted connection"
);
}
CAF_TEST
(
doorman
accept
)
{
auto
acceptor
=
unbox
(
make_tcp_accept_socket
(
auth
,
false
));
auto
port
=
unbox
(
local_port
(
socket_cast
<
network_socket
>
(
acceptor
)));
...
...
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