version 1.2.2.11, 2012/06/01 13:13:40
|
version 1.2.2.12, 2012/06/19 08:32:17
|
Line 8 io_enableDEBUG;
|
Line 8 io_enableDEBUG;
|
|
|
extern char compiled[], compiledby[], compilehost[]; |
extern char compiled[], compiledby[], compilehost[]; |
volatile intptr_t Kill; |
volatile intptr_t Kill; |
|
sched_root_task_t *root; |
|
|
struct tagArgs *args; |
struct tagArgs *args; |
|
|
Line 102 Unsubscribe(int sock)
|
Line 103 Unsubscribe(int sock)
|
} |
} |
|
|
|
|
|
static void * |
|
pubRX(sched_task_t *task) |
|
{ |
|
int siz, rlen; |
|
char szTopic[BUFSIZ] = { 0 }; |
|
void *data = NULL; |
|
u_short mid; |
|
|
|
rlen = RecvFrom(TASK_FD(task)); |
|
if (siz == -1) |
|
goto end; |
|
siz = mqtt_readPUBLISH(args->msg->msg_base, szTopic, sizeof szTopic, &mid, &data); |
|
if (siz == -1) |
|
goto end; |
|
|
|
fprintf(TASK_ARG(task), "\nMessage ID: 0x%04hu\n", mid); |
|
|
|
if (data) { |
|
fputs((const char*) data, TASK_ARG(task)); |
|
free(data); |
|
} |
|
end: |
|
schedReadSelf(task); |
|
return NULL; |
|
} |
|
|
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
Line 280 main(int argc, char **argv)
|
Line 308 main(int argc, char **argv)
|
else |
else |
lf = stdout; |
lf = stdout; |
if (lf) { |
if (lf) { |
|
root = schedBegin(); |
|
|
ret = Subscribe(args->cli->sock, lf); |
ret = Subscribe(args->cli->sock, lf); |
|
|
|
schedRead(root, pubRX, lf, args->cli->sock, NULL, 0); |
|
schedRun(root, &Kill); |
|
|
if (un) |
if (un) |
Unsubscribe(args->cli->sock); |
Unsubscribe(args->cli->sock); |
fclose(lf); |
fclose(lf); |
|
|
|
schedEnd(&root); |
} else |
} else |
printf("Error:: in subscribe file #%d - %s\n", errno, strerror(errno)); |
printf("Error:: in subscribe file #%d - %s\n", errno, strerror(errno)); |
} else |
} else |