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
0affeae9
Commit
0affeae9
authored
May 31, 2020
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix connection test
parent
3cd6dd58
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
6 deletions
+25
-6
libcaf_net/caf/net/backend/tcp.hpp
libcaf_net/caf/net/backend/tcp.hpp
+1
-0
libcaf_net/caf/net/backend/test.hpp
libcaf_net/caf/net/backend/test.hpp
+2
-0
libcaf_net/src/net/backend/test.cpp
libcaf_net/src/net/backend/test.cpp
+4
-0
libcaf_net/src/net/middleman.cpp
libcaf_net/src/net/middleman.cpp
+0
-1
libcaf_net/test/net/backend/tcp.cpp
libcaf_net/test/net/backend/tcp.cpp
+18
-5
No files found.
libcaf_net/caf/net/backend/tcp.hpp
View file @
0affeae9
...
...
@@ -106,6 +106,7 @@ private:
CAF_RAISE_ERROR
(
"mgr->init() failed"
);
}
mpx
->
register_reading
(
mgr
);
peers_
.
emplace
(
peer_id
,
std
::
move
(
mgr
));
return
peers_
[
peer_id
];
}
...
...
libcaf_net/caf/net/backend/test.hpp
View file @
0affeae9
...
...
@@ -51,6 +51,8 @@ public:
endpoint_manager_ptr
peer
(
const
node_id
&
id
)
override
;
endpoint_manager_ptr
connect
(
const
uri
&
locator
)
override
;
void
publish
(
actor
handle
,
const
uri
&
locator
)
override
;
void
resolve
(
const
uri
&
locator
,
const
actor
&
listener
)
override
;
...
...
libcaf_net/src/net/backend/test.cpp
View file @
0affeae9
...
...
@@ -54,6 +54,10 @@ endpoint_manager_ptr test::peer(const node_id& id) {
return
get_peer
(
id
).
second
;
}
endpoint_manager_ptr
test
::
connect
(
const
uri
&
)
{
return
nullptr
;
}
void
test
::
publish
(
actor
,
const
uri
&
)
{
// nop
}
...
...
libcaf_net/src/net/middleman.cpp
View file @
0affeae9
...
...
@@ -86,7 +86,6 @@ void middleman::init(actor_system_config& cfg) {
CAF_LOG_ERROR
(
"failed to initialize backend: "
<<
err
);
CAF_RAISE_ERROR
(
"failed to initialize backend"
);
}
std
::
cout
<<
"init"
<<
std
::
endl
;
}
middleman
::
module
::
id_t
middleman
::
id
()
const
{
...
...
libcaf_net/test/net/backend/tcp.cpp
View file @
0affeae9
...
...
@@ -23,9 +23,12 @@
#include "caf/net/test/host_fixture.hpp"
#include "caf/test/dsl.hpp"
#include <string>
#include "caf/ip_endpoint.hpp"
#include "caf/net/middleman.hpp"
#include "caf/net/socket_guard.hpp"
#include "caf/net/tcp_accept_socket.hpp"
using
namespace
caf
;
using
namespace
caf
::
net
;
...
...
@@ -78,17 +81,27 @@ CAF_TEST(doorman accept) {
}
CAF_TEST
(
connect
)
{
CAF_CHECK_EQUAL
(
mpx
->
num_socket_managers
(),
2
);
ip_endpoint
ep
;
if
(
auto
err
=
detail
::
parse
(
"[::]:0"
,
ep
))
CAF_FAIL
(
"could not parse endpoint"
<<
err
);
auto
acceptor
=
make_tcp_accept_socket
(
ep
);
CAF_CHECK
(
!
acceptor
)
if
(
!
acceptor
)
CAF_FAIL
(
"could not create acceptor"
<<
CAF_ARG2
(
"err"
,
acceptor
.
error
()));
auto
acc_guard
=
make_socket_guard
(
*
acceptor
);
auto
port
=
local_port
(
*
acc_guard
);
auto
uri_str
=
std
::
string
(
"tcp://localhost:"
)
+
std
::
to_string
(
port
);
auto
port
=
local_port
(
acc_guard
.
socket
());
if
(
!
port
)
CAF_FAIL
(
"could not read port"
<<
CAF_ARG2
(
"err"
,
port
.
error
()));
auto
uri_str
=
std
::
string
(
"tcp://localhost:"
)
+
std
::
to_string
(
*
port
);
CAF_MESSAGE
(
"connecting to "
<<
CAF_ARG
(
uri_str
));
auto
ptr
=
mm
.
backend
(
"tcp"
);
CAF_CHECK
(
mm
->
connect
(
make_uri
(
ep_string
)));
auto
ret
=
mm
.
connect
(
*
make_uri
(
uri_str
));
if
(
!
ret
)
CAF_FAIL
(
"could not connect to "
<<
uri_str
);
auto
sock
=
accept
(
acc_guard
.
socket
());
if
(
!
sock
)
CAF_FAIL
(
"accepting failed"
);
handle_io_event
();
CAF_CHECK_EQUAL
(
mpx
->
num_socket_managers
(),
3
);
}
CAF_TEST_FIXTURE_SCOPE_END
()
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