Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
network_throttle.cpp
Go to the documentation of this file.
1
28
29
// Copyrights(c) 2017-2021, The Electroneum Project
30
// Copyrights(c) 2014-2019, The Monero Project
31
//
32
// All rights reserved.
33
//
34
// Redistribution and use in source and binary forms, with or without modification, are
35
// permitted provided that the following conditions are met:
36
//
37
// 1. Redistributions of source code must retain the above copyright notice, this list of
38
// conditions and the following disclaimer.
39
//
40
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
41
// of conditions and the following disclaimer in the documentation and/or other
42
// materials provided with the distribution.
43
//
44
// 3. Neither the name of the copyright holder nor the names of its contributors may be
45
// used to endorse or promote products derived from this software without specific
46
// prior written permission.
47
//
48
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
49
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
50
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
51
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
53
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
54
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
55
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
56
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57
58
#include "
net/network_throttle-detail.hpp
"
59
60
namespace
epee
61
{
62
namespace
net_utils
63
{
64
65
// ================================================================================================
66
// network_throttle_manager
67
// ================================================================================================
68
69
// ================================================================================================
70
// static:
71
boost::mutex
network_throttle_manager::m_lock_get_global_throttle_in
;
72
boost::mutex
network_throttle_manager::m_lock_get_global_throttle_inreq
;
73
boost::mutex
network_throttle_manager::m_lock_get_global_throttle_out
;
74
75
// ================================================================================================
76
// methods:
77
i_network_throttle
&
network_throttle_manager::get_global_throttle_in
() {
78
static
network_throttle
obj_get_global_throttle_in(
"in/all"
,
"<<< global-IN"
,10);
79
return
obj_get_global_throttle_in;
80
}
81
82
83
84
i_network_throttle
&
network_throttle_manager::get_global_throttle_inreq
() {
85
static
network_throttle
obj_get_global_throttle_inreq(
"inreq/all"
,
"<== global-IN-REQ"
,10);
86
return
obj_get_global_throttle_inreq;
87
}
88
89
90
i_network_throttle
&
network_throttle_manager::get_global_throttle_out
() {
91
static
network_throttle
obj_get_global_throttle_out(
"out/all"
,
">>> global-OUT"
,10);
92
return
obj_get_global_throttle_out;
93
}
94
95
96
97
98
network_throttle_bw::network_throttle_bw
(
const
std::string &name1)
99
:
m_in
(
"in/"
+name1, name1+
"-DOWNLOAD"
),
m_inreq
(
"inreq/"
+name1, name1+
"-DOWNLOAD-REQUESTS"
),
m_out
(
"out/"
+name1, name1+
"-UPLOAD"
)
100
{ }
101
102
103
104
105
}
// namespace
106
}
// namespace
107
108
109
110
111
epee::net_utils::i_network_throttle
Definition
network_throttle.hpp:133
epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_inreq
static boost::mutex m_lock_get_global_throttle_inreq
Definition
network_throttle.hpp:116
epee::net_utils::network_throttle_manager::get_global_throttle_inreq
static i_network_throttle & get_global_throttle_inreq()
ditto ; use lock ... use m_lock_get_global_throttle_inreq obviously
Definition
network_throttle.cpp:84
epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_in
static boost::mutex m_lock_get_global_throttle_in
Definition
network_throttle.hpp:115
epee::net_utils::network_throttle_manager::get_global_throttle_in
static i_network_throttle & get_global_throttle_in()
singleton ; for friend class ; caller MUST use proper locks! like m_lock_get_global_throttle_in
Definition
network_throttle.cpp:77
epee::net_utils::network_throttle_manager::get_global_throttle_out
static i_network_throttle & get_global_throttle_out()
ditto ; use lock ... use m_lock_get_global_throttle_out obviously
Definition
network_throttle.cpp:90
epee::net_utils::network_throttle_manager::m_lock_get_global_throttle_out
static boost::mutex m_lock_get_global_throttle_out
Definition
network_throttle.hpp:117
epee::net_utils::network_throttle
Definition
network_throttle-detail.hpp:49
epee::net_utils
Definition
gzip_encoding.h:40
epee
Definition
ado_db_helper.h:67
network_throttle-detail.hpp
implementaion for throttling of connection (count and rate-limit speed etc)
epee::net_utils::network_throttle_bw::m_in
network_throttle m_in
for incomming traffic (this we can not controll directly as it depends of what others send to us - us...
Definition
network_throttle-detail.hpp:114
epee::net_utils::network_throttle_bw::m_out
network_throttle m_out
for outgoing traffic that we just sent (this is exact usually)
Definition
network_throttle-detail.hpp:116
epee::net_utils::network_throttle_bw::network_throttle_bw
network_throttle_bw(const std::string &name1)
Definition
network_throttle.cpp:98
epee::net_utils::network_throttle_bw::m_inreq
network_throttle m_inreq
for requesting incomming traffic (this is exact usually)
Definition
network_throttle-detail.hpp:115
contrib
epee
src
network_throttle.cpp
Generated on
for Electroneum by
1.17.0