version 1.2.2.13, 2012/05/08 13:04:02
|
version 1.2.2.16, 2012/05/08 14:36:10
|
Line 72 cmdSUBSCRIBE(void *srv, int len, void *arg)
|
Line 72 cmdSUBSCRIBE(void *srv, int len, void *arg)
|
|
|
/* add to db */ |
/* add to db */ |
for (i = 0; i < siz; i++) { |
for (i = 0; i < siz; i++) { |
if (call.WritePUB_subscribe(&cfg, pub, mid, subs[i].sub_topic.msg_base, | if (call.WritePUB_subscribe(&cfg, pub, sess->sess_cid, mid, subs[i].sub_topic.msg_base, |
sess->sess_user, sess->sess_addr, subs[i].sub_ret) > 0) { |
sess->sess_user, sess->sess_addr, subs[i].sub_ret) > 0) { |
store = malloc(sizeof(struct tagStore)); |
store = malloc(sizeof(struct tagStore)); |
if (!store) { |
if (!store) { |
Line 138 cmdUNSUBSCRIBE(void *srv, int len, void *arg)
|
Line 138 cmdUNSUBSCRIBE(void *srv, int len, void *arg)
|
!strcmp(store->st_subscr.sub_topic.msg_base, |
!strcmp(store->st_subscr.sub_topic.msg_base, |
subs[i].sub_topic.msg_base)) { |
subs[i].sub_topic.msg_base)) { |
SLIST_REMOVE(&sess->sess_subscr, store, tagStore, st_node); |
SLIST_REMOVE(&sess->sess_subscr, store, tagStore, st_node); |
|
|
|
if (store->st_subscr.sub_topic.msg_base) |
|
free(store->st_subscr.sub_topic.msg_base); |
|
if (store->st_subscr.sub_value.msg_base) |
|
free(store->st_subscr.sub_value.msg_base); |
free(store); |
free(store); |
} |
} |
} |
} |
|
|
call.DeletePUB_subscribe(&cfg, pub, subs[i].sub_topic.msg_base, | call.DeletePUB_subscribe(&cfg, pub, sess->sess_cid, subs[i].sub_topic.msg_base, |
sess->sess_user, sess->sess_addr); | sess->sess_user, "%"); |
} |
} |
|
|
/* send acknowledge */ |
/* send acknowledge */ |
Line 205 cmdCONNECT(void *srv, int len, void *arg)
|
Line 210 cmdCONNECT(void *srv, int len, void *arg)
|
ioDEBUG(5, "Exec CONNECT session"); |
ioDEBUG(5, "Exec CONNECT session"); |
TAILQ_REMOVE(&Sessions, sess, sess_node); |
TAILQ_REMOVE(&Sessions, sess, sess_node); |
|
|
if (call.FiniSessPUB) | if (sess->sess_clean) { |
call.FiniSessPUB(&cfg, pub, sess->sess_cid, sess->sess_user, "%"); | if (call.FiniSessPUB) |
| call.FiniSessPUB(&cfg, pub, sess->sess_cid, sess->sess_user, "%"); |
| if (call.DeletePUB_subscribe) |
| call.DeletePUB_subscribe(&cfg, pub, sess->sess_cid, "%", sess->sess_user, "%"); |
| if (call.WipePUB_topic) |
| call.WipePUB_topic(&cfg, pub, sess->sess_cid, sess->sess_user, -1); |
| } |
|
|
while ((store = SLIST_FIRST(&sess->sess_subscr))) { |
while ((store = SLIST_FIRST(&sess->sess_subscr))) { |
SLIST_REMOVE_HEAD(&sess->sess_subscr, st_node); |
SLIST_REMOVE_HEAD(&sess->sess_subscr, st_node); |