Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
93ba5e32
Commit
93ba5e32
authored
Jul 26, 2018
by
TousakaRin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CreateConcurrencyLimiterOrDie would not return NULL now
parent
24afccac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
concurrency_limiter.cpp
src/brpc/concurrency_limiter.cpp
+0
-4
concurrency_limiter.h
src/brpc/concurrency_limiter.h
+3
-1
server_private_accessor.h
src/brpc/details/server_private_accessor.h
+5
-6
No files found.
src/brpc/concurrency_limiter.cpp
View file @
93ba5e32
...
@@ -20,10 +20,6 @@ namespace brpc {
...
@@ -20,10 +20,6 @@ namespace brpc {
ConcurrencyLimiter
*
ConcurrencyLimiter
::
CreateConcurrencyLimiterOrDie
(
ConcurrencyLimiter
*
ConcurrencyLimiter
::
CreateConcurrencyLimiterOrDie
(
const
AdaptiveMaxConcurrency
&
max_concurrency
)
{
const
AdaptiveMaxConcurrency
&
max_concurrency
)
{
if
(
max_concurrency
==
"constant"
&&
static_cast
<
int
>
(
max_concurrency
)
==
0
)
{
return
NULL
;
}
const
ConcurrencyLimiter
*
cl
=
const
ConcurrencyLimiter
*
cl
=
ConcurrencyLimiterExtension
()
->
Find
(
max_concurrency
.
name
().
c_str
());
ConcurrencyLimiterExtension
()
->
Find
(
max_concurrency
.
name
().
c_str
());
CHECK
(
cl
!=
NULL
)
CHECK
(
cl
!=
NULL
)
...
...
src/brpc/concurrency_limiter.h
View file @
93ba5e32
...
@@ -26,7 +26,7 @@ namespace brpc {
...
@@ -26,7 +26,7 @@ namespace brpc {
class
ConcurrencyLimiter
:
public
Destroyable
{
class
ConcurrencyLimiter
:
public
Destroyable
{
public
:
public
:
ConcurrencyLimiter
()
:
_max_concurrency
(
0
)
{}
ConcurrencyLimiter
()
:
_max_concurrency
(
0
)
{}
// This method should be called each time a request comes in. It returns
// This method should be called each time a request comes in. It returns
// false when the concurrency reaches the upper limit, otherwise it
// false when the concurrency reaches the upper limit, otherwise it
...
@@ -56,6 +56,8 @@ public:
...
@@ -56,6 +56,8 @@ public:
virtual
~
ConcurrencyLimiter
()
{}
virtual
~
ConcurrencyLimiter
()
{}
// Create ConcurrencyLimiter* and coredump if it fails.
// Caller is responsible for Destroy() the instance after usage.
static
ConcurrencyLimiter
*
CreateConcurrencyLimiterOrDie
(
static
ConcurrencyLimiter
*
CreateConcurrencyLimiterOrDie
(
const
AdaptiveMaxConcurrency
&
max_concurrency
);
const
AdaptiveMaxConcurrency
&
max_concurrency
);
...
...
src/brpc/details/server_private_accessor.h
View file @
93ba5e32
...
@@ -40,17 +40,16 @@ public:
...
@@ -40,17 +40,16 @@ public:
// Returns true if the `max_concurrency' limit is not reached.
// Returns true if the `max_concurrency' limit is not reached.
bool
AddConcurrency
(
Controller
*
c
)
{
bool
AddConcurrency
(
Controller
*
c
)
{
c
->
add_flag
(
Controller
::
FLAGS_ADDED_CONCURRENCY
);
if
(
NULL
!=
_server
->
_cl
)
{
if
(
NULL
!=
_server
->
_cl
)
{
c
->
add_flag
(
Controller
::
FLAGS_ADDED_CONCURRENCY
);
return
_server
->
_cl
->
OnRequested
();
return
_server
->
_cl
->
OnRequested
();
}
else
{
}
return
true
;
return
true
;
}
}
}
void
RemoveConcurrency
(
const
Controller
*
c
)
{
void
RemoveConcurrency
(
const
Controller
*
c
)
{
if
(
c
->
has_flag
(
Controller
::
FLAGS_ADDED_CONCURRENCY
)
&&
if
(
c
->
has_flag
(
Controller
::
FLAGS_ADDED_CONCURRENCY
)
){
NULL
!=
_server
->
_cl
)
{
CHECK
(
_server
->
_cl
!=
NULL
)
_server
->
_cl
->
OnResponded
(
c
->
ErrorCode
(),
c
->
latency_us
());
_server
->
_cl
->
OnResponded
(
c
->
ErrorCode
(),
c
->
latency_us
());
}
}
}
}
...
...
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