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:
@ -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:
|
||||
|
Reference in New Issue
Block a user