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
c8966119
Commit
c8966119
authored
Dec 14, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #112 from mavam/topic/variable-msg-size
Make the maximum message size configurable.
parents
715ade35
1dfc3d4a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
cppa/cppa.hpp
cppa/cppa.hpp
+12
-0
src/buffer.cpp
src/buffer.cpp
+4
-3
src/middleman.cpp
src/middleman.cpp
+19
-1
No files found.
cppa/cppa.hpp
View file @
c8966119
...
...
@@ -445,6 +445,18 @@ namespace cppa {
* @{
*/
/**
* @brief Sets the maximum size of a message.
* @param size The maximum number of bytes a message may occupy.
*/
void
max_msg_size
(
size_t
size
);
/**
* @brief Retrieves the maximum size of messages.
* @returns The number maximum number of bytes a message may occupy.
*/
size_t
max_msg_size
();
/**
* @brief Sends a message to @p whom.
*
...
...
src/buffer.cpp
View file @
c8966119
...
...
@@ -28,10 +28,12 @@
\******************************************************************************/
#include <atomic>
#include <ios> // std::ios_base::failure
#include <cstring>
#include <utility>
#include "cppa/cppa.hpp"
#include "cppa/util/buffer.hpp"
#include "cppa/io/input_stream.hpp"
...
...
@@ -40,13 +42,12 @@ namespace cppa { namespace util {
namespace
{
const
size_t
default_chunk_size
=
512
;
const
size_t
default_max_size
=
16
*
1024
*
1024
;
}
// namespace anonymous
buffer
::
buffer
()
:
m_data
(
nullptr
),
m_written
(
0
),
m_allocated
(
0
),
m_final_size
(
0
)
,
m_chunk_size
(
default_chunk_size
),
m_max_buffer_size
(
default_max_size
)
{
}
,
m_chunk_size
(
default_chunk_size
),
m_max_buffer_size
(
max_msg_size
()
)
{
}
buffer
::
buffer
(
size_t
chunk_size
,
size_t
max_buffer_size
)
:
m_data
(
nullptr
),
m_written
(
0
),
m_allocated
(
0
),
m_final_size
(
0
)
...
...
@@ -62,7 +63,7 @@ buffer::buffer(buffer&& other)
buffer
::
buffer
(
const
buffer
&
other
)
:
m_data
(
nullptr
),
m_written
(
0
),
m_allocated
(
0
),
m_final_size
(
0
)
,
m_chunk_size
(
default_chunk_size
),
m_max_buffer_size
(
default_max_size
)
{
,
m_chunk_size
(
default_chunk_size
),
m_max_buffer_size
(
max_msg_size
()
)
{
write
(
other
,
grow_if_needed
);
}
...
...
src/middleman.cpp
View file @
c8966119
...
...
@@ -388,4 +388,22 @@ void middleman_loop(middleman_impl* impl) {
CPPA_LOGF_DEBUG
(
"middleman loop done"
);
}
}
}
// namespace cppa::detail
}
// namespace io
namespace
{
std
::
atomic
<
size_t
>
default_max_msg_size
{
16
*
1024
*
1024
};
}
// namespace <anonymous>
void
max_msg_size
(
size_t
size
)
{
default_max_msg_size
=
size
;
}
size_t
max_msg_size
()
{
return
default_max_msg_size
;
}
}
// namespace cppa
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