Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
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
Libraries
nghttp2
Commits
c7815946
Commit
c7815946
authored
Aug 07, 2017
by
Soham Sinha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a function to free a client from Worker's list of client, if the client is destroyed
parent
b72ca028
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
15 deletions
+37
-15
src/h2load.cc
src/h2load.cc
+35
-15
src/h2load.h
src/h2load.h
+2
-0
No files found.
src/h2load.cc
View file @
c7815946
...
...
@@ -193,6 +193,7 @@ void writecb(struct ev_loop *loop, ev_io *w, int revents) {
rv
=
client
->
connect
();
if
(
rv
!=
0
)
{
client
->
fail
();
client
->
worker
->
free_client
(
client
);
delete
client
;
return
;
}
...
...
@@ -200,6 +201,7 @@ void writecb(struct ev_loop *loop, ev_io *w, int revents) {
}
if
(
rv
!=
0
)
{
client
->
fail
();
client
->
worker
->
free_client
(
client
);
delete
client
;
}
}
...
...
@@ -213,6 +215,7 @@ void readcb(struct ev_loop *loop, ev_io *w, int revents) {
if
(
client
->
try_again_or_fail
()
==
0
)
{
return
;
}
client
->
worker
->
free_client
(
client
);
delete
client
;
return
;
}
...
...
@@ -245,10 +248,11 @@ void rate_period_timeout_w_cb(struct ev_loop *loop, ev_timer *w, int revents) {
client
->
fail
();
}
else
{
if
(
worker
->
config
->
is_timing_based_mode
())
{
worker
->
clients
.
push_back
(
client
.
get
());
}
worker
->
clients
.
push_back
(
client
.
release
());
}
else
{
client
.
release
();
}
}
worker
->
report_rate_progress
();
}
if
(
!
worker
->
config
->
is_timing_based_mode
())
{
...
...
@@ -268,11 +272,13 @@ void duration_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
auto
worker
=
static_cast
<
Worker
*>
(
w
->
data
);
for
(
auto
client
:
worker
->
clients
)
{
if
(
client
)
{
client
->
req_todo
=
client
->
req_done
;
// there was no finite "req_todo"
worker
->
stats
.
req_todo
+=
client
->
req_todo
;
client
->
req_inflight
=
0
;
client
->
req_left
=
0
;
}
}
worker
->
current_phase
=
Phase
::
DURATION_OVER
;
...
...
@@ -296,6 +302,7 @@ void warmup_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
assert
(
worker
->
stats
.
req_done
==
0
);
for
(
auto
client
:
worker
->
clients
)
{
if
(
client
)
{
assert
(
client
->
req_todo
==
0
);
assert
(
client
->
req_left
==
1
);
assert
(
client
->
req_inflight
==
0
);
...
...
@@ -306,6 +313,7 @@ void warmup_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) {
client
->
clear_connect_times
();
client
->
record_connect_start_time
();
}
}
worker
->
current_phase
=
Phase
::
MAIN_DURATION
;
...
...
@@ -1339,12 +1347,24 @@ Worker::~Worker() {
void
Worker
::
stop_all_clients
()
{
for
(
auto
client
:
clients
)
{
if
(
client
->
session
)
{
if
(
client
&&
client
->
session
)
{
client
->
terminate_session
();
}
}
}
void
Worker
::
free_client
(
Client
*
deleted_client
)
{
for
(
auto
&
client
:
clients
)
{
if
(
client
==
deleted_client
)
{
client
->
req_todo
=
client
->
req_done
;
stats
.
req_todo
+=
client
->
req_todo
;
auto
index
=
&
client
-
&
clients
[
0
];
clients
[
index
]
=
NULL
;
return
;
}
}
}
void
Worker
::
run
()
{
if
(
!
config
->
is_rate_mode
()
&&
!
config
->
is_timing_based_mode
())
{
for
(
size_t
i
=
0
;
i
<
nclients
;
++
i
)
{
...
...
src/h2load.h
View file @
c7815946
...
...
@@ -286,6 +286,8 @@ struct Worker {
void
report_rate_progress
();
// This function calls the destructors of all the clients.
void
stop_all_clients
();
// This function frees a client from the list of clients for this Worker.
void
free_client
(
Client
*
);
};
struct
Stream
{
...
...
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