version 1.2.2.12, 2012/06/19 08:32:17
|
version 1.2.2.13, 2012/06/20 09:23:28
|
Line 107 static void *
|
Line 107 static void *
|
pubRX(sched_task_t *task) |
pubRX(sched_task_t *task) |
{ |
{ |
int siz, rlen; |
int siz, rlen; |
char szTopic[BUFSIZ] = { 0 }; | char szTopic[STRSIZ] = { 0 }; |
void *data = NULL; |
void *data = NULL; |
u_short mid; |
u_short mid; |
|
|
rlen = RecvFrom(TASK_FD(task)); |
rlen = RecvFrom(TASK_FD(task)); |
if (siz == -1) | if (rlen == -1) |
goto end; |
goto end; |
siz = mqtt_readPUBLISH(args->msg->msg_base, szTopic, sizeof szTopic, &mid, &data); | siz = mqtt_readPUBLISH(args->msg, szTopic, sizeof szTopic, &mid, &data); |
if (siz == -1) |
if (siz == -1) |
goto end; |
goto end; |
|
|
fprintf(TASK_ARG(task), "\nMessage ID: 0x%04hu\n", mid); | fprintf(TASK_ARG(task), "\nMessage ID: 0x%04hu, Length: %u, Topic: %s\n", |
| mid, siz, szTopic); |
|
|
if (data) { |
if (data) { |
fputs((const char*) data, TASK_ARG(task)); |
fputs((const char*) data, TASK_ARG(task)); |
free(data); |
free(data); |
} |
} |
|
|
|
fprintf(TASK_ARG(task), "\n.\n"); |
|
fflush(TASK_ARG(task)); |
end: |
end: |
schedReadSelf(task); |
schedReadSelf(task); |
return NULL; |
return NULL; |