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
3717d263
Commit
3717d263
authored
Oct 16, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add configurable number of buffers
parent
9673e37a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
3 deletions
+80
-3
libcaf_net/CMakeLists.txt
libcaf_net/CMakeLists.txt
+1
-0
libcaf_net/caf/net/defaults.hpp
libcaf_net/caf/net/defaults.hpp
+36
-0
libcaf_net/caf/net/stream_transport.hpp
libcaf_net/caf/net/stream_transport.hpp
+11
-3
libcaf_net/src/defaults.cpp
libcaf_net/src/defaults.cpp
+32
-0
No files found.
libcaf_net/CMakeLists.txt
View file @
3717d263
...
...
@@ -32,6 +32,7 @@ set(LIBCAF_NET_SRCS
src/tcp_accept_socket.cpp
src/tcp_stream_socket.cpp
src/udp_datagram_socket.cpp
src/defaults.cpp
)
add_custom_target
(
libcaf_net
)
...
...
libcaf_net/caf/net/defaults.hpp
0 → 100644
View file @
3717d263
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 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. *
******************************************************************************/
#pragma once
#include <cstddef>
// -- hard-coded default values for various CAF options ------------------------
namespace
caf
{
namespace
defaults
{
namespace
middleman
{
extern
const
size_t
max_output_buffers
;
extern
const
size_t
max_header_buffers
;
}
// namespace middleman
}
// namespace defaults
}
// namespace caf
\ No newline at end of file
libcaf_net/caf/net/stream_transport.hpp
View file @
3717d263
...
...
@@ -18,11 +18,13 @@
#pragma once
#include "caf/actor_system_config.hpp"
#include "caf/byte.hpp"
#include "caf/error.hpp"
#include "caf/expected.hpp"
#include "caf/fwd.hpp"
#include "caf/logger.hpp"
#include "caf/net/defaults.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/receive_policy.hpp"
#include "caf/net/stream_socket.hpp"
...
...
@@ -90,6 +92,10 @@ public:
template
<
class
Parent
>
error
init
(
Parent
&
parent
)
{
manager_
=
&
parent
;
max_output_bufs_
=
get_or
(
system
().
config
(),
"middleman.max-output-buffers"
,
defaults
::
middleman
::
max_output_buffers
);
max_header_bufs_
=
get_or
(
system
().
config
(),
"middleman.max-header-buffers"
,
defaults
::
middleman
::
max_header_buffers
);
if
(
auto
err
=
worker_
.
init
(
*
this
))
return
err
;
return
none
;
...
...
@@ -246,9 +252,9 @@ private:
auto
&
buf
=
front
.
second
;
written_
=
0
;
buf
.
clear
();
if
(
is_header
)
if
(
is_header
&&
free_header_bufs_
.
size
()
<
max_header_bufs_
)
free_header_bufs_
.
emplace_back
(
std
::
move
(
buf
));
else
else
if
(
free_bufs_
.
size
()
<
max_output_bufs_
)
free_bufs_
.
emplace_back
(
std
::
move
(
buf
));
write_queue_
.
pop_front
();
};
...
...
@@ -291,6 +297,8 @@ private:
std
::
deque
<
buffer_type
>
free_header_bufs_
;
std
::
deque
<
buffer_type
>
free_bufs_
;
size_t
max_output_bufs_
;
size_t
max_header_bufs_
;
buffer_type
read_buf_
;
std
::
deque
<
std
::
pair
<
bool
,
buffer_type
>>
write_queue_
;
...
...
@@ -305,7 +313,7 @@ private:
size_t
written_
;
endpoint_manager
*
manager_
;
};
};
// namespace net
}
// namespace net
}
// namespace caf
libcaf_net/src/defaults.cpp
0 → 100644
View file @
3717d263
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 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. *
******************************************************************************/
#include "caf/net/defaults.hpp"
namespace
caf
{
namespace
defaults
{
namespace
middleman
{
const
size_t
max_output_buffers
=
100
;
const
size_t
max_header_buffers
=
10
;
}
// namespace middleman
}
// namespace defaults
}
// namespace caf
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