Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Actual fix.

  • Loading branch information...
commit 72d03e757b59c6bd1e4f493899d3955cb295a7db 1 parent 6a7f80a
@evan authored
Showing with 12 additions and 23 deletions.
  1. +12 −23 hstress.c
View
35 hstress.c
@@ -96,7 +96,6 @@ struct event reportev;
struct timeval reporttv ={ 1, 0 };
struct timeval timeouttv ={ 1, 0 };
struct timeval lastreporttv;
-struct timeval zerotv = { 0, 0 };
int request_timeout;
struct timeval ratetv;
int ratecount = 0;
@@ -108,7 +107,6 @@ struct evhttp_connection *mkhttp();
void recvcb(struct evhttp_request *req, void *arg);
void timeoutcb(int fd, short what, void *arg);
-void dispatchcb(int fd, short what, void *arg);
void closecb(struct evhttp_connection *evcon, void *arg);
void report();
@@ -121,6 +119,12 @@ rateLimitingEnabled()
}
unsigned char
+requestsPerConnectionEnabled()
+{
+ return params.rpc > 0;
+}
+
+unsigned char
tsvOutputEnabled()
{
return params.tsvout != nil;
@@ -300,15 +304,13 @@ complete(int how, Runner *runner)
if(params.count<0 || conn_total<params.count){
// re-scheduling is handled by the callback
if(!rateLimitingEnabled()){
- if(params.rpc<0 || params.rpc>req->evcon_reqno){
+ if(!requestsPerConnectionEnabled() || req->evcon_reqno<params.rpc){
dispatch(runner, req->evcon_reqno + 1);
}else{
- /* There seems to be a bug in libevent where the connection isn't really
- * freed until the event loop is unwound. We'll add ourselves back with a
- * 0-second timeout. */
- evtimer_set(&req->dispatchev, dispatchcb, runner);
- evtimer_add(&req->dispatchev, &zerotv);
- debug("complete(): evtimer_add(dispatchev, &zerotv);\n");
+ // re-establish the connection
+ evhttp_connection_free(runner->evcon);
+ runner->evcon = mkhttp();
+ dispatch(runner, 1);
}
} else {
}
@@ -400,19 +402,6 @@ timeoutcb(int fd, short what, void *arg)
}
void
-dispatchcb(int fd, short what, void *arg)
-{
- debug("dispatchcb()\n");
- Runner *runner = (Runner *)arg;
-
- /* re-establish the connection */
- evhttp_connection_free(runner->evcon);
- runner->evcon = mkhttp();
-
- dispatch(runner, 1);
-}
-
-void
closecb(struct evhttp_connection *evcon, void *arg)
{
debug("closecb()\n");
@@ -678,7 +667,7 @@ main(int argc, char **argv)
panic("Invalid arguments: couldn't understand host and port.");
}
- if(rateLimitingEnabled() && params.rpc > -1)
+ if(rateLimitingEnabled() && requestsPerConnectionEnabled())
panic("Invalid arguments: -l (MAX_QPS) does not support -r (RPC).");
http_hostname = host;
Please sign in to comment.
Something went wrong with that request. Please try again.