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 21, 2017
2 parents 4c37a14 + d651a31 commit 31711eb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tcp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ static void clean_useless_client()
{
jwHashTable *table = get_xkcp_hash();
for(int i = 0; i < table->buckets; i++) {
debug(LOG_DEBUG, " index %d clean_useless_client", i);
jwHashEntry *entry = table->bucket[i];
while(entry) {
jwHashEntry *next = entry->next;
jwHashEntry *previous = NULL;
while(entry) {
iqueue_head *list = entry->value.ptrValue;
if (list && iqueue_is_empty(list)) {
debug(LOG_DEBUG, "3 clean_useless_client");
if(!previous)
table->bucket[hash] = entry->next;
else
previous->next = entry->next;
free(entry->value.strValue);
free(entry->key.strValue);
free(entry);
}
// move to next entry
entry = next;;
previous = entry;
entry = entry->next;
}
}

debug(LOG_DEBUG, "here");
}

void tcp_client_event_cb(struct bufferevent *bev, short what, void *ctx)
Expand Down

0 comments on commit 31711eb

Please sign in to comment.