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
b4a34ae9
Commit
b4a34ae9
authored
Nov 29, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some basp tests that use datagram components
parent
3996b8d4
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
389 additions
and
32 deletions
+389
-32
libcaf_io/caf/io/network/test_multiplexer.hpp
libcaf_io/caf/io/network/test_multiplexer.hpp
+10
-3
libcaf_io/src/test_multiplexer.cpp
libcaf_io/src/test_multiplexer.cpp
+18
-10
libcaf_io/test/basp.cpp
libcaf_io/test/basp.cpp
+361
-19
No files found.
libcaf_io/caf/io/network/test_multiplexer.hpp
View file @
b4a34ae9
...
...
@@ -130,8 +130,11 @@ public:
/// Returns the output buffer of the datagram source identified by `hdl`.
buffer_type
&
output_buffer
(
dgram_scribe_handle
hdl
);
/// Returns complete deque of messages
std
::
deque
<
buffer_type
>&
output_queue
(
dgram_scribe_handle
hdl
);
/// Returns the input buffer of the scribe identified by `hdl`.
buffer_type
&
input_buffer
(
dgram_scribe_handle
hdl
);
buffer_type
&
input_buffer
(
dgram_scribe_handle
hdl
);
/// Returns the input buffer of the scribe identified by `hdl`.
buffer_type
&
input_buffer
(
connection_handle
hdl
);
...
...
@@ -212,7 +215,8 @@ public:
bool
has_pending_scribe
(
std
::
string
host
,
uint16_t
port
);
/// Stores `hdl` as a pending endpoint for `src`.
void
add_pending_endpoints
(
dgram_doorman_handle
src
,
dgram_scribe_handle
hdl
);
/// Although no transport connection is buid, the nameing eases testing.
void
add_pending_connect
(
dgram_doorman_handle
src
,
dgram_scribe_handle
hdl
);
using
pending_endpoints_map
=
std
::
unordered_multimap
<
dgram_doorman_handle
,
dgram_scribe_handle
>
;
...
...
@@ -232,7 +236,7 @@ public:
/// Accepts a pending connect on `hdl`.
bool
accept_connection
(
accept_handle
hdl
);
bool
accept_
endpoint
(
dgram_doorman_handle
hdl
);
bool
accept_
connection
(
dgram_doorman_handle
hdl
);
/// Reads data from the external input buffer until
/// the configured read policy no longer allows receiving.
...
...
@@ -298,6 +302,8 @@ private:
uint16_t
local_port
;
std
::
deque
<
buffer_type
>
xbuf
;
std
::
deque
<
buffer_type
>
wr_buf
;
//buffer_type xbuf;
//buffer_type wr_buf;
buffer_type
rd_buf
;
size_t
rcv_buffer_size
=
1500
;
bool
stopped_reading
=
false
;
...
...
@@ -310,6 +316,7 @@ private:
uint16_t
remote_port
;
uint16_t
local_port
;
std
::
deque
<
buffer_type
>
xbuf
;
//buffer_type xbuf;
buffer_type
rd_buf
;
size_t
rcv_buffer_size
=
1500
;
bool
stopped_reading
=
false
;
...
...
libcaf_io/src/test_multiplexer.cpp
View file @
b4a34ae9
...
...
@@ -274,7 +274,8 @@ expected<void> test_multiplexer::assign_dgram_scribe(abstract_broker* ptr,
}
uint16_t
port
()
const
override
{
return
mpx_
->
port
(
hdl
());
//return mpx_->port(hdl());
return
static_cast
<
uint16_t
>
(
hdl
().
id
());
}
void
flush
()
override
{
...
...
@@ -293,6 +294,7 @@ expected<void> test_multiplexer::assign_dgram_scribe(abstract_broker* ptr,
test_multiplexer
*
mpx_
;
};
auto
dsptr
=
make_counted
<
impl
>
(
ptr
,
hdl
,
this
);
impl_ptr
(
hdl
)
=
dsptr
;
ptr
->
add_dgram_scribe
(
dsptr
);
return
unit
;
}
...
...
@@ -335,7 +337,7 @@ test_multiplexer::new_dgram_doorman(uint16_t desired_port, const char*, bool) {
}
expected
<
void
>
test_multiplexer
::
assign_dgram_doorman
(
abstract_broker
*
ptr
,
dgram_doorman_handle
hdl
)
{
dgram_doorman_handle
hdl
)
{
class
impl
:
public
dgram_doorman
{
public:
impl
(
abstract_broker
*
self
,
dgram_doorman_handle
dsh
,
test_multiplexer
*
mpx
)
...
...
@@ -396,8 +398,9 @@ expected<void> test_multiplexer::assign_dgram_doorman(abstract_broker* ptr,
private:
test_multiplexer
*
mpx_
;
};
auto
dsptr
=
make_counted
<
impl
>
(
ptr
,
hdl
,
this
);
ptr
->
add_dgram_doorman
(
dsptr
);
auto
ddptr
=
make_counted
<
impl
>
(
ptr
,
hdl
,
this
);
impl_ptr
(
hdl
)
=
ddptr
;
ptr
->
add_dgram_doorman
(
ddptr
);
return
unit
;
}
...
...
@@ -448,9 +451,10 @@ void test_multiplexer::provide_dgram_scribe(std::string host,
}
void
test_multiplexer
::
provide_dgram_doorman
(
uint16_t
desired_port
,
dgram_doorman_handle
hdl
)
{
dgram_doormen_
.
emplace
(
std
::
make_pair
(
desired_port
,
hdl
)
);
dgram_doorman_handle
hdl
)
{
dgram_doormen_
.
emplace
(
desired_port
,
hdl
);
dgram_doorman_data_
[
hdl
].
remote_port
=
desired_port
;
dgram_doorman_data_
[
hdl
].
local_port
=
desired_port
;
}
/// The external input buffer should be filled by
...
...
@@ -520,6 +524,11 @@ test_multiplexer::output_buffer(dgram_scribe_handle hdl) {
return
buf
.
back
();
}
std
::
deque
<
test_multiplexer
::
buffer_type
>&
test_multiplexer
::
output_queue
(
dgram_scribe_handle
hdl
)
{
return
dgram_scribe_data_
[
hdl
].
wr_buf
;
}
bool
&
test_multiplexer
::
stopped_reading
(
dgram_scribe_handle
hdl
)
{
return
dgram_scribe_data_
[
hdl
].
stopped_reading
;
}
...
...
@@ -596,8 +605,8 @@ void test_multiplexer::add_pending_connect(accept_handle src,
pending_connects_
.
emplace
(
src
,
hdl
);
}
void
test_multiplexer
::
add_pending_
endpoints
(
dgram_doorman_handle
src
,
dgram_scribe_handle
hdl
)
{
void
test_multiplexer
::
add_pending_
connect
(
dgram_doorman_handle
src
,
dgram_scribe_handle
hdl
)
{
pending_endpoints_
.
emplace
(
src
,
hdl
);
}
...
...
@@ -630,13 +639,12 @@ bool test_multiplexer::accept_connection(accept_handle hdl) {
return
true
;
}
bool
test_multiplexer
::
accept_
endpoint
(
dgram_doorman_handle
hdl
)
{
bool
test_multiplexer
::
accept_
connection
(
dgram_doorman_handle
hdl
)
{
if
(
passive_mode
(
hdl
))
return
false
;
auto
&
dd
=
dgram_doorman_data_
[
hdl
];
if
(
!
dd
.
ptr
)
return
false
;
// TODO: Is this the right new_enpoint call?
if
(
!
dd
.
ptr
->
new_endpoint
(
dd
.
rd_buf
.
data
(),
dd
.
rd_buf
.
size
()))
passive_mode
(
hdl
)
=
true
;
return
true
;
...
...
libcaf_io/test/basp.cpp
View file @
b4a34ae9
This diff is collapsed.
Click to expand it.
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