Skip to content

Commit

Permalink
Update xkcp_mon.c
Browse files Browse the repository at this point in the history
  • Loading branch information
liudf0716 authored Apr 21, 2017
1 parent 38a98e9 commit a8830fa
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions xkcp_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,20 @@ static void get_server_status(struct bufferevent *bev, void *ctx)
static void process_user_cmd(struct bufferevent *bev, const char *cmd, void *ctx)
{
debug(LOG_DEBUG, "cmd is %s", cmd);
int i = 0;
struct user_spy_cmd *spy_cmd;

if (xkcp_server_flag) {
spy_cmd = server_cmd;
for(int i = 0; server_cmd[i].command != NULL; i++) {
if (strcmp(cmd, server_cmd[i].command) == 0)
server_cmd[i].cmd_process(bev, ctx);
}
} else {
spy_cmd = client_cmd;
for(int i = 0; client_cmd[i].command != NULL; i++) {
if (strcmp(cmd, client_cmd[i].command) == 0)
client_cmd[i].cmd_process(bev, ctx);
}
}

for(; spy_cmd[i].command != NULL; i++) {
if (strcmp(cmd, spy_cmd[i].command) == 0)
spy_cmd[i].cmd_process(bev, ctx);
}


}

Expand Down

0 comments on commit a8830fa

Please sign in to comment.