Skip to content

Commit

Permalink
在打印树结构的函数中添加对各个节点的待发送包情况的打印
Browse files Browse the repository at this point in the history
  • Loading branch information
Allanceng committed Dec 17, 2014
1 parent 9ce967a commit 8ffa179
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/read_handle_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ int mqtt3_handle_subscribe(struct mosquitto_db *db, struct mosquitto *context)
}
}

if(qos != 0x80){
if(qos != 0x80){ //mosquitto_acl_check如果检查没有问题
// printf("it's crutial to subclient%s\n", sub);
rc2 = mqtt3_sub_add(db, context, sub, qos, &db->subs);
if(rc2 == MOSQ_ERR_SUCCESS){
Expand Down
15 changes: 14 additions & 1 deletion src/subs.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ void mqtt3_sub_tree_print(struct _mosquitto_subhier *root, int level)//负责打
int i;
struct _mosquitto_subhier *branch;
struct _mosquitto_subleaf *leaf;

struct _mosquitto_packet *packet; //allan adds
for(i=0; i<level*2; i++){
printf(" ");
}
Expand All @@ -575,6 +575,19 @@ void mqtt3_sub_tree_print(struct _mosquitto_subhier *root, int level)//负责打
while(leaf){
if(leaf->context){
printf(" (context->id:%s, qos:%d)", leaf->context->id, leaf->qos);
printf("last_mid:%d\n", leaf->context->last_mid);
packet = leaf->context->out_packet;
while(packet)
{
printf("packet payload:%s\n", packet->payload);
packet = packet->next;
}
packet = leaf->context->current_out_packet;
while(packet)
{
printf("packet payload:%s\n", packet->payload);
packet = packet->next;
}
}else{
printf(" (%s, qos:%d)", "", leaf->qos);
}
Expand Down

0 comments on commit 8ffa179

Please sign in to comment.