|
|
| version 1.1.2.6, 2011/12/14 12:45:30 | version 1.1.2.8, 2011/12/20 15:03:42 |
|---|---|
| Line 26 try2Connect(int sock) | Line 26 try2Connect(int sock) |
| int siz = 0; | int siz = 0; |
| struct pollfd pfd; | struct pollfd pfd; |
| printf("ka=%d\n", args->ka); | siz = mqtt_msgCONNECT(args->msg, (char*) AIT_GET_STR(&args->ConnID), args->ka, |
| siz = mqtt_msgCONNECT(args->msg, AIT_GET_STR(&args->ConnID), args->ka, | (char*) AIT_GET_STR(&args->User), (char*) AIT_GET_STR(&args->Pass), |
| AIT_GET_STR(&args->User), AIT_GET_STR(&args->Pass), | (char*) args->Will.Topic.val.string, (char*) args->Will.Msg.val.string, |
| args->Will.Topic.val.string, args->Will.Msg.val.string, | |
| !args->notClear, args->QoS, args->Retain); | !args->notClear, args->QoS, args->Retain); |
| if (siz == -1) { | if (siz == -1) { |
| printf("Error:: msgCONNECT #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); | printf("Error:: msgCONNECT #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
| Line 41 try2Connect(int sock) | Line 40 try2Connect(int sock) |
| printf("Error:: send() #%d - %s\n", errno, strerror(errno)); | printf("Error:: send() #%d - %s\n", errno, strerror(errno)); |
| return -1; | return -1; |
| } else | } else |
| VERB(3) printf("Sended CONNECT %d bytes\n", siz); | ioVERBOSE(3) printf("Sended CONNECT %d bytes\n", siz); |
| printf("ka=%d\n", args->ka); | |
| pfd.fd = sock; | pfd.fd = sock; |
| pfd.events = POLLIN; | pfd.events = POLLIN; |
| switch (poll(&pfd, 1, args->ka * 1000)) { | switch (poll(&pfd, 1, args->ka * 1000)) { |
| Line 51 try2Connect(int sock) | Line 49 try2Connect(int sock) |
| printf("Error:: poll() #%d - %s\n", errno, strerror(errno)); | printf("Error:: poll() #%d - %s\n", errno, strerror(errno)); |
| return -1; | return -1; |
| case 0: | case 0: |
| printf("ka=%d\n", args->ka); | ioVERBOSE(3) printf("Timeout reached (%d) ...\n", args->ka * 1000); |
| VERB(3) printf("Timeout reached (%d) ...\n", args->ka * 1000); | |
| return -1; | return -1; |
| } | } |
| if (pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) | if (pfd.revents & (POLLERR | POLLHUP | POLLNVAL)) |
| Line 63 try2Connect(int sock) | Line 60 try2Connect(int sock) |
| printf("Error:: recv() #%d - %s\n", errno, strerror(errno)); | printf("Error:: recv() #%d - %s\n", errno, strerror(errno)); |
| return -1; | return -1; |
| } else | } else |
| VERB(3) printf("Received %d bytes\n", siz); | ioVERBOSE(3) printf("Received %d bytes\n", siz); |
| return (u_char) mqtt_readCONNACK(args->msg); | return (u_char) mqtt_readCONNACK(args->msg); |
| } | } |