version 1.2.2.7, 2012/04/27 10:07:51
|
version 1.2.2.8, 2012/04/27 16:41:56
|
Line 72 cmdSUBSCRIBE(void *srv, void *arg)
|
Line 72 cmdSUBSCRIBE(void *srv, void *arg)
|
|
|
/* add to db */ |
/* add to db */ |
for (i = 0; i < siz; i++) { |
for (i = 0; i < siz; i++) { |
if ((siz = call.WritePUB_subscribe(&cfg, pub, mid, subs[i].sub_topic.msg_base, | if (call.WritePUB_subscribe(&cfg, pub, 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) { |
ioSYSERR(0); |
ioSYSERR(0); |
goto end; |
goto end; |
} else { |
} else { |
store->st_msgid = mid; |
store->st_msgid = mid; |
store->st_subscr = subs[i]; | mqtt_subCopy(&store->st_subscr, &subs[i]); |
} |
} |
|
|
/* add to cache */ |
/* add to cache */ |
Line 101 cmdSUBSCRIBE(void *srv, void *arg)
|
Line 101 cmdSUBSCRIBE(void *srv, void *arg)
|
} |
} |
if ((siz = send(sess->sess_sock, sess->sess_buf->msg_base, siz, 0)) == -1) |
if ((siz = send(sess->sess_sock, sess->sess_buf->msg_base, siz, 0)) == -1) |
ioSYSERR(0); |
ioSYSERR(0); |
else | else { |
ioDEBUG(5, "Sended %d bytes.", siz); |
ioDEBUG(5, "Sended %d bytes.", siz); |
|
memset(sess->sess_buf->msg_base, 0, sess->sess_buf->msg_len); |
|
} |
end: |
end: |
mqtt_subFree(&subs); |
mqtt_subFree(&subs); |
return 0; |
return 0; |
Line 141 cmdPINGREQ(void *srv, void *arg)
|
Line 143 cmdPINGREQ(void *srv, void *arg)
|
if ((siz = send(sess->sess_sock, sess->sess_buf->msg_base, siz, 0)) == -1) { |
if ((siz = send(sess->sess_sock, sess->sess_buf->msg_base, siz, 0)) == -1) { |
ioSYSERR(0); |
ioSYSERR(0); |
return 0; |
return 0; |
} else | } else { |
ioDEBUG(5, "Sended %d bytes.", siz); |
ioDEBUG(5, "Sended %d bytes.", siz); |
|
memset(sess->sess_buf->msg_base, 0, sess->sess_buf->msg_len); |
|
} |
|
|
return 0; |
return 0; |
} |
} |