Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/liudf0716/xkcp_client
Browse files Browse the repository at this point in the history
  • Loading branch information
Dengfeng Liu committed Apr 25, 2017
2 parents 285ac03 + db93129 commit e4a2080
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xkcp_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static void get_client_info(struct bufferevent *bev, void *ctx)
jwHashEntry *entry = xkcp_hash->bucket[i];
while (entry) {
evbuffer_add_printf(output, "hash_id [%d] connected client [%s] connection [%d] \n",
i, entry->key.strValue, get_task_list_size(entry->key.ptrValue));
i, entry->key.strValue, get_task_list_size(entry->value.ptrValue));
entry = entry->next;
}
}
Expand Down
13 changes: 13 additions & 0 deletions xkcp_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ static void dump_task(struct xkcp_task *task, struct bufferevent *bev, int index
ikcp_peeksize(task->kcp), task->kcp->stream);
}

int get_task_list_size(iqueue_head *task_list)
{
struct xkcp_task *task;
int num = 0;
iqueue_foreach(task, task_list, xkcp_task_type, head) {
if (task->kcp) {
num++;
}
}

return num;
}

void dump_task_list(iqueue_head *task_list, struct bufferevent *bev) {
struct xkcp_task *task;
task_list_count = 0;
Expand Down
2 changes: 2 additions & 0 deletions xkcp_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ void add_task_tail(struct xkcp_task *task, iqueue_head *head);

void del_task(struct xkcp_task *task);

int get_task_list_size(iqueue_head *task_list);

void dump_task_list(iqueue_head *task_list, struct bufferevent *bev);

void xkcp_set_config_param(ikcpcb *kcp);
Expand Down

0 comments on commit e4a2080

Please sign in to comment.