Improved behavior of debug cli API command 'fail accept'. It takes now _two_ arguments, Syntax:

fail accept <errno> <repeat count>

Changed fail_next_accept from boolean to decreasing counter.
This commit is contained in:
vraatikka
2013-09-24 15:48:59 +03:00
parent e637ea3844
commit 09cc20b7be
4 changed files with 26 additions and 38 deletions

View File

@ -233,7 +233,7 @@ struct subcommand disableoptions[] = {
static void fail_backendfd(void);
static void fail_clientfd(void);
static void fail_accept(DCB* dcb, char* arg1);
static void fail_accept(DCB* dcb, char* arg1, char* arg2);
/**
* * The subcommands of the fail command
* */
@ -254,10 +254,10 @@ struct subcommand failoptions[] = {
},
{
"accept",
1,
2,
fail_accept,
"Fail to accept next client connection.",
{ARG_TYPE_STRING, 0, 0}
{ARG_TYPE_STRING, ARG_TYPE_STRING, 0}
},
{
NULL,
@ -775,10 +775,13 @@ static void fail_clientfd(void)
static void fail_accept(
DCB* dcb,
char* arg1)
char* arg1,
char* arg2)
{
int failcount = MIN(atoi(arg2), 100);
fail_accept_errno = atoi(arg1);
switch(fail_accept_errno) {
case EAGAIN:
// case EWOULDBLOCK:
@ -792,7 +795,7 @@ static void fail_accept(
case ENOBUFS:
case ENOMEM:
case EPROTO:
fail_next_accept = true;
fail_next_accept = failcount;
break;
default: