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
645c15ac
Commit
645c15ac
authored
Nov 09, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add datagram related functions
parent
1b2652ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
libcaf_io/caf/io/abstract_broker.hpp
libcaf_io/caf/io/abstract_broker.hpp
+14
-0
libcaf_io/src/abstract_broker.cpp
libcaf_io/src/abstract_broker.cpp
+32
-0
No files found.
libcaf_io/caf/io/abstract_broker.hpp
View file @
645c15ac
...
...
@@ -159,6 +159,20 @@ public:
/// Sends the content of the buffer for given connection.
void
flush
(
connection_handle
hdl
);
/// Enables or disables write notifications for given datagram socket.
void
ack_writes
(
datagram_sink_handle
hdl
,
bool
enable
);
/// Modifies the buffer for received datagrams.
/// @param hdl Identifies the affected socket.
/// @param buf_size Size of the receiver buffer for the next datagram.
void
configure_datagram_size
(
datagram_source_handle
hdl
,
size_t
buf_size
);
/// Returns write buffer for given sink.
std
::
vector
<
char
>&
wr_buf
(
datagram_sink_handle
hdl
);
/// Writes `data` into the buffer of a given sink.
void
write
(
datagram_sink_handle
hdl
,
size_t
data_size
,
const
void
*
data
);
/// Returns the middleman instance this broker belongs to.
inline
middleman
&
parent
()
{
return
system
().
middleman
();
...
...
libcaf_io/src/abstract_broker.cpp
View file @
645c15ac
...
...
@@ -110,6 +110,38 @@ void abstract_broker::flush(connection_handle hdl) {
x
->
flush
();
}
void
abstract_broker
::
ack_writes
(
datagram_sink_handle
hdl
,
bool
enable
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
)
<<
CAF_ARG
(
enable
));
auto
x
=
by_id
(
hdl
);
if
(
x
)
x
->
ack_writes
(
enable
);
}
void
abstract_broker
::
configure_datagram_size
(
datagram_source_handle
hdl
,
size_t
buf_size
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
)
<<
CAF_ARG
(
buf_size
));
auto
x
=
by_id
(
hdl
);
if
(
x
)
x
->
configure_datagram_size
(
buf_size
);
}
std
::
vector
<
char
>&
abstract_broker
::
wr_buf
(
datagram_sink_handle
hdl
)
{
auto
x
=
by_id
(
hdl
);
if
(
!
x
)
{
CAF_LOG_ERROR
(
"tried to access wr_buf() of an unknown connection_handle"
);
return
dummy_wr_buf_
;
}
return
x
->
wr_buf
();
}
void
abstract_broker
::
write
(
datagram_sink_handle
hdl
,
size_t
bs
,
const
void
*
buf
)
{
auto
&
out
=
wr_buf
(
hdl
);
auto
first
=
reinterpret_cast
<
const
char
*>
(
buf
);
auto
last
=
first
+
bs
;
out
.
insert
(
out
.
end
(),
first
,
last
);
}
std
::
vector
<
connection_handle
>
abstract_broker
::
connections
()
const
{
std
::
vector
<
connection_handle
>
result
;
result
.
reserve
(
scribes_
.
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