|
|
| version 1.1.2.7, 2012/01/05 13:09:05 | version 1.2.2.3, 2012/04/16 00:09:57 |
|---|---|
| Line 53 Publish(int sock) | Line 53 Publish(int sock) |
| int siz = 0; | int siz = 0; |
| siz = mqtt_msgPUBLISH(args->msg, AIT_GET_STR(&args->Publish), args->MsgID, args->Dup, | siz = mqtt_msgPUBLISH(args->msg, AIT_GET_STR(&args->Publish), args->MsgID, args->Dup, |
| args->QoS, args->Retain, AIT_GET_PTR2(&args->Value), AIT_LEN(&args->Value)); | args->QoS, args->Retain, AIT_ADDR(&args->Value), AIT_LEN(&args->Value)); |
| if (siz == -1) { | if (siz == -1) { |
| printf("Error:: msgPUBLISH #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | printf("Error:: msgPUBLISH #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
| return -1; | return -1; |
| Line 89 Publish(int sock) | Line 89 Publish(int sock) |
| goto end; | goto end; |
| } | } |
| siz = mqtt_msgPUBREL(args->msg, args->MsgID); | do { |
| if (siz == -1) { | siz = mqtt_msgPUBREL(args->msg, args->MsgID); |
| printf("Error:: msgPUBREL #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | if (siz == -1) { |
| return -1; | printf("Error:: msgPUBREL #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
| } | return -1; |
| if (SendTo(sock, siz) == -1) | } |
| return -1; | if (SendTo(sock, siz) == -1) |
| return -1; | |
| if ((siz = RecvFrom(sock)) == -1 || !siz) | if ((siz = RecvFrom(sock)) == -1 || !siz) |
| return -1; | return -1; |
| siz = mqtt_readPUBCOMP(args->msg); | siz = mqtt_readPUBCOMP(args->msg); |
| if (siz == args->MsgID) | if (siz == args->MsgID) |
| return siz; | return siz; |
| if (!args->Dup) { | if (!args->Dup) { |
| args->Dup++; | args->Dup++; |
| return Publish(sock); | continue; |
| } | } |
| } while (0); | |
| end: | end: |
| printf("Error:: Message not delivered\n"); | printf("Error:: Message not delivered\n"); |
| Line 224 main(int argc, char **argv) | Line 226 main(int argc, char **argv) |
| } | } |
| if (args->QoS && !args->MsgID) | if (args->QoS && !args->MsgID) |
| args->MsgID = MQTT_DEFAULT_MSGID; | args->MsgID = MQTT_DEFAULT_MSGID; |
| ioVERBOSE(1) printf("Connecting to %s:%d ...\n", io_n2addr(&args->addr, &val), io_n2port(&args->addr)); | printf("Connecting to %s:%d ... ", io_n2addr(&args->addr, &val), io_n2port(&args->addr)); |
| AIT_FREE_VAL(&val); | |
| if ((sock = InitClient()) == -1) { | if ((sock = InitClient()) == -1) { |
| args->free(args); | args->free(args); |
| Line 238 main(int argc, char **argv) | Line 241 main(int argc, char **argv) |
| return 3; | return 3; |
| } | } |
| printf("Connected ... "); | |
| switch ((ret = ConnectClient(sock))) { | switch ((ret = ConnectClient(sock))) { |
| case -1: | case -1: |
| printf(">> FAILED!\n"); | printf(">> FAILED!\n"); |