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
29535532
Commit
29535532
authored
Oct 16, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add configurable number of buffers
parent
55ab269d
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 @
29535532
...
@@ -32,6 +32,7 @@ set(LIBCAF_NET_SRCS
...
@@ -32,6 +32,7 @@ set(LIBCAF_NET_SRCS
src/tcp_accept_socket.cpp
src/tcp_accept_socket.cpp
src/tcp_stream_socket.cpp
src/tcp_stream_socket.cpp
src/udp_datagram_socket.cpp
src/udp_datagram_socket.cpp
src/defaults.cpp
)
)
add_custom_target
(
libcaf_net
)
add_custom_target
(
libcaf_net
)
...
...
libcaf_net/caf/net/defaults.hpp
0 → 100644
View file @
29535532
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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 @
29535532
...
@@ -18,11 +18,13 @@
...
@@ -18,11 +18,13 @@
#pragma once
#pragma once
#include "caf/actor_system_config.hpp"
#include "caf/byte.hpp"
#include "caf/byte.hpp"
#include "caf/error.hpp"
#include "caf/error.hpp"
#include "caf/expected.hpp"
#include "caf/expected.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
#include "caf/logger.hpp"
#include "caf/logger.hpp"
#include "caf/net/defaults.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/endpoint_manager.hpp"
#include "caf/net/receive_policy.hpp"
#include "caf/net/receive_policy.hpp"
#include "caf/net/stream_socket.hpp"
#include "caf/net/stream_socket.hpp"
...
@@ -90,6 +92,10 @@ public:
...
@@ -90,6 +92,10 @@ public:
template
<
class
Parent
>
template
<
class
Parent
>
error
init
(
Parent
&
parent
)
{
error
init
(
Parent
&
parent
)
{
manager_
=
&
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
))
if
(
auto
err
=
worker_
.
init
(
*
this
))
return
err
;
return
err
;
return
none
;
return
none
;
...
@@ -246,9 +252,9 @@ private:
...
@@ -246,9 +252,9 @@ private:
auto
&
buf
=
front
.
second
;
auto
&
buf
=
front
.
second
;
written_
=
0
;
written_
=
0
;
buf
.
clear
();
buf
.
clear
();
if
(
is_header
)
if
(
is_header
&&
free_header_bufs_
.
size
()
<
max_header_bufs_
)
free_header_bufs_
.
emplace_back
(
std
::
move
(
buf
));
free_header_bufs_
.
emplace_back
(
std
::
move
(
buf
));
else
else
if
(
free_bufs_
.
size
()
<
max_output_bufs_
)
free_bufs_
.
emplace_back
(
std
::
move
(
buf
));
free_bufs_
.
emplace_back
(
std
::
move
(
buf
));
write_queue_
.
pop_front
();
write_queue_
.
pop_front
();
};
};
...
@@ -291,6 +297,8 @@ private:
...
@@ -291,6 +297,8 @@ private:
std
::
deque
<
buffer_type
>
free_header_bufs_
;
std
::
deque
<
buffer_type
>
free_header_bufs_
;
std
::
deque
<
buffer_type
>
free_bufs_
;
std
::
deque
<
buffer_type
>
free_bufs_
;
size_t
max_output_bufs_
;
size_t
max_header_bufs_
;
buffer_type
read_buf_
;
buffer_type
read_buf_
;
std
::
deque
<
std
::
pair
<
bool
,
buffer_type
>>
write_queue_
;
std
::
deque
<
std
::
pair
<
bool
,
buffer_type
>>
write_queue_
;
...
@@ -305,7 +313,7 @@ private:
...
@@ -305,7 +313,7 @@ private:
size_t
written_
;
size_t
written_
;
endpoint_manager
*
manager_
;
endpoint_manager
*
manager_
;
};
};
// namespace net
}
// namespace net
}
// namespace net
}
// namespace caf
}
// namespace caf
libcaf_net/src/defaults.cpp
0 → 100644
View file @
29535532
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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