net: mqtt: fix tests to use zsock_ functions
Use zsock_ variants of socket functions in mqtt tests. Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
This commit is contained in:
parent
c737cca7be
commit
9e5dc213cb
3 changed files with 12 additions and 12 deletions
|
@ -27,7 +27,7 @@ static uint8_t rx_buffer[BUFFER_SIZE];
|
|||
static uint8_t tx_buffer[BUFFER_SIZE];
|
||||
static struct mqtt_client client_ctx;
|
||||
static struct sockaddr broker;
|
||||
static struct pollfd fds[1];
|
||||
static struct zsock_pollfd fds[1];
|
||||
static int nfds;
|
||||
static bool connected;
|
||||
|
||||
|
@ -38,13 +38,13 @@ static void broker_init(void)
|
|||
|
||||
broker6->sin6_family = AF_INET6;
|
||||
broker6->sin6_port = htons(SERVER_PORT);
|
||||
inet_pton(AF_INET6, SERVER_ADDR, &broker6->sin6_addr);
|
||||
zsock_inet_pton(AF_INET6, SERVER_ADDR, &broker6->sin6_addr);
|
||||
#else
|
||||
struct sockaddr_in *broker4 = net_sin(&broker);
|
||||
|
||||
broker4->sin_family = AF_INET;
|
||||
broker4->sin_port = htons(SERVER_PORT);
|
||||
inet_pton(AF_INET, SERVER_ADDR, &broker4->sin_addr);
|
||||
zsock_inet_pton(AF_INET, SERVER_ADDR, &broker4->sin_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ static void clear_fds(void)
|
|||
static void wait(int timeout)
|
||||
{
|
||||
if (nfds > 0) {
|
||||
if (poll(fds, nfds, timeout) < 0) {
|
||||
if (zsock_poll(fds, nfds, timeout) < 0) {
|
||||
TC_PRINT("poll error: %d\n", errno);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ static uint8_t rx_buffer[BUFFER_SIZE];
|
|||
static uint8_t tx_buffer[BUFFER_SIZE];
|
||||
static struct mqtt_client client_ctx;
|
||||
static struct sockaddr broker;
|
||||
static struct pollfd fds[1];
|
||||
static struct zsock_pollfd fds[1];
|
||||
static int nfds;
|
||||
static bool connected;
|
||||
static int payload_left;
|
||||
|
@ -64,13 +64,13 @@ static void broker_init(void)
|
|||
|
||||
broker6->sin6_family = AF_INET6;
|
||||
broker6->sin6_port = htons(SERVER_PORT);
|
||||
inet_pton(AF_INET6, SERVER_ADDR, &broker6->sin6_addr);
|
||||
zsock_inet_pton(AF_INET6, SERVER_ADDR, &broker6->sin6_addr);
|
||||
#else
|
||||
struct sockaddr_in *broker4 = net_sin(&broker);
|
||||
|
||||
broker4->sin_family = AF_INET;
|
||||
broker4->sin_port = htons(SERVER_PORT);
|
||||
inet_pton(AF_INET, SERVER_ADDR, &broker4->sin_addr);
|
||||
zsock_inet_pton(AF_INET, SERVER_ADDR, &broker4->sin_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ static void clear_fds(void)
|
|||
static void wait(int timeout)
|
||||
{
|
||||
if (nfds > 0) {
|
||||
if (poll(fds, nfds, timeout) < 0) {
|
||||
if (zsock_poll(fds, nfds, timeout) < 0) {
|
||||
TC_PRINT("poll error: %d\n", errno);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ static uint8_t rx_buffer[BUFFER_SIZE];
|
|||
static uint8_t tx_buffer[BUFFER_SIZE];
|
||||
static struct mqtt_client client_ctx;
|
||||
static struct sockaddr broker;
|
||||
static struct pollfd fds[1];
|
||||
static struct zsock_pollfd fds[1];
|
||||
static int nfds;
|
||||
static bool connected;
|
||||
|
||||
|
@ -34,13 +34,13 @@ static void broker_init(void)
|
|||
|
||||
broker6->sin6_family = AF_INET6;
|
||||
broker6->sin6_port = htons(SERVER_PORT);
|
||||
inet_pton(AF_INET6, SERVER_ADDR, &broker6->sin6_addr);
|
||||
zsock_inet_pton(AF_INET6, SERVER_ADDR, &broker6->sin6_addr);
|
||||
#else
|
||||
struct sockaddr_in *broker4 = net_sin(&broker);
|
||||
|
||||
broker4->sin_family = AF_INET;
|
||||
broker4->sin_port = htons(SERVER_PORT);
|
||||
inet_pton(AF_INET, SERVER_ADDR, &broker4->sin_addr);
|
||||
zsock_inet_pton(AF_INET, SERVER_ADDR, &broker4->sin_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ static void clear_fds(void)
|
|||
static void wait(int timeout)
|
||||
{
|
||||
if (nfds > 0) {
|
||||
if (poll(fds, nfds, timeout) < 0) {
|
||||
if (zsock_poll(fds, nfds, timeout) < 0) {
|
||||
TC_PRINT("poll error: %d\n", errno);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue