version 1.1.2.6, 2012/01/05 10:26:02
|
version 1.1.2.8, 2012/01/24 10:18:45
|
Line 67 Publish(int sock)
|
Line 67 Publish(int sock)
|
if ((siz = RecvFrom(sock)) == -1 || !siz) |
if ((siz = RecvFrom(sock)) == -1 || !siz) |
return -1; |
return -1; |
/* QoS == MQTT_QOS_ACK, wait for PUBACK */ |
/* QoS == MQTT_QOS_ACK, wait for PUBACK */ |
if (args->QoS == MQTT_QOS_ACK) | if (args->QoS == MQTT_QOS_ACK) { |
return mqtt_readPUBACK(args->msg); | siz = mqtt_readPUBACK(args->msg); |
| if (siz == args->MsgID) |
| return siz; |
| if (!args->Dup) { |
| args->Dup++; |
| return Publish(sock); |
| } |
| goto end; |
| } |
|
|
|
|
/* QoS == MQTT_QOS_EXACTLY */ |
/* QoS == MQTT_QOS_EXACTLY */ |
if (mqtt_readPUBREC(args->msg) != args->MsgID) { | siz = mqtt_readPUBREC(args->msg); |
printf("Error:: Message not delivered\n"); | if (siz != args->MsgID) { |
return -1; | if (!args->Dup) { |
| args->Dup++; |
| return Publish(sock); |
| } |
| goto end; |
} |
} |
|
|
siz = mqtt_msgPUBREL(args->msg, args->MsgID); |
siz = mqtt_msgPUBREL(args->msg, args->MsgID); |
Line 87 Publish(int sock)
|
Line 99 Publish(int sock)
|
|
|
if ((siz = RecvFrom(sock)) == -1 || !siz) |
if ((siz = RecvFrom(sock)) == -1 || !siz) |
return -1; |
return -1; |
return mqtt_readPUBCOMP(args->msg); | |
| siz = mqtt_readPUBCOMP(args->msg); |
| if (siz == args->MsgID) |
| return siz; |
| if (!args->Dup) { |
| args->Dup++; |
| return Publish(sock); |
| } |
| |
| end: |
| printf("Error:: Message not delivered\n"); |
| return -1; |
} |
} |
|
|
|
|
Line 216 main(int argc, char **argv)
|
Line 239 main(int argc, char **argv)
|
} |
} |
|
|
printf("Connected ... "); |
printf("Connected ... "); |
|
ConnectClient(sock); ConnectClient(sock); |
switch ((ret = ConnectClient(sock))) { |
switch ((ret = ConnectClient(sock))) { |
case -1: |
case -1: |
printf(">> FAILED!\n"); |
printf(">> FAILED!\n"); |
Line 239 main(int argc, char **argv)
|
Line 263 main(int argc, char **argv)
|
printf(">> DENIED.\n"); |
printf(">> DENIED.\n"); |
break; |
break; |
} |
} |
|
sleep(1); |
|
|
if (ret == MQTT_RETCODE_ACCEPTED) { |
if (ret == MQTT_RETCODE_ACCEPTED) { |
ret = !(Publish(sock) == args->MsgID); |
ret = !(Publish(sock) == args->MsgID); |