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
680be0d1
Commit
680be0d1
authored
Oct 25, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add using id_type = ...
parent
8510b2a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
libcaf_net/caf/net/datagram_transport.hpp
libcaf_net/caf/net/datagram_transport.hpp
+11
-11
No files found.
libcaf_net/caf/net/datagram_transport.hpp
View file @
680be0d1
...
...
@@ -47,6 +47,8 @@ class datagram_transport {
public:
// -- member types -----------------------------------------------------------
using
id_type
=
ip_endpoint
;
using
buffer_type
=
std
::
vector
<
byte
>
;
using
buffer_cache_type
=
std
::
vector
<
buffer_type
>
;
...
...
@@ -55,8 +57,7 @@ public:
using
transport_type
=
datagram_transport
<
Factory
>
;
using
dispatcher_type
=
transport_worker_dispatcher
<
transport_type
,
ip_endpoint
>
;
using
dispatcher_type
=
transport_worker_dispatcher
<
transport_type
,
id_type
>
;
using
application_type
=
typename
Factory
::
application_type
;
...
...
@@ -169,15 +170,15 @@ public:
dispatcher_
.
timeout
(
*
this
,
value
,
id
);
}
void
set_timeout
(
uint64_t
timeout_id
,
i
p_endpoint
ep
)
{
dispatcher_
.
set_timeout
(
timeout_id
,
ep
);
void
set_timeout
(
uint64_t
timeout_id
,
i
d_type
id
)
{
dispatcher_
.
set_timeout
(
timeout_id
,
id
);
}
void
handle_error
(
sec
code
)
{
dispatcher_
.
handle_error
(
code
);
}
error
add_new_worker
(
node_id
node
,
i
p_endpoint
id
)
{
error
add_new_worker
(
node_id
node
,
i
d_type
id
)
{
return
dispatcher_
.
add_new_worker
(
*
this
,
node
,
id
);
}
...
...
@@ -214,13 +215,13 @@ public:
prepare_next_read
();
}
void
write_packet
(
i
p_endpoint
ep
,
span
<
buffer_type
*>
buffers
)
{
void
write_packet
(
i
d_type
id
,
span
<
buffer_type
*>
buffers
)
{
CAF_ASSERT
(
!
buffers
.
empty
());
if
(
packet_queue_
.
empty
())
manager
().
register_writing
();
// By convention, the first buffer is a header buffer. Every other buffer is
// a payload buffer.
packet_queue_
.
emplace_back
(
ep
,
buffers
);
packet_queue_
.
emplace_back
(
id
,
buffers
);
}
// -- buffer management ------------------------------------------------------
...
...
@@ -235,12 +236,11 @@ public:
/// Helper struct for managing outgoing packets
struct
packet
{
i
p_endpoint
destination
;
i
d_type
id
;
buffer_cache_type
bytes
;
size_t
size
;
packet
(
ip_endpoint
destination
,
span
<
buffer_type
*>
bufs
)
:
destination
(
destination
)
{
packet
(
id_type
id
,
span
<
buffer_type
*>
bufs
)
:
id
(
id
)
{
size
=
0
;
for
(
auto
buf
:
bufs
)
{
size
+=
buf
->
size
();
...
...
@@ -286,7 +286,7 @@ private:
std
::
vector
<
std
::
vector
<
byte
>*>
ptrs
;
for
(
auto
&
buf
:
packet
.
bytes
)
ptrs
.
emplace_back
(
&
buf
);
auto
write_ret
=
write
(
handle_
,
make_span
(
ptrs
),
packet
.
destination
);
auto
write_ret
=
write
(
handle_
,
make_span
(
ptrs
),
packet
.
id
);
if
(
auto
num_bytes
=
get_if
<
size_t
>
(
&
write_ret
))
{
CAF_LOG_DEBUG
(
CAF_ARG
(
handle_
.
id
)
<<
CAF_ARG
(
*
num_bytes
));
CAF_LOG_WARNING_IF
(
*
num_bytes
<
packet
.
size
,
...
...
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