mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-02 12:52:10 +00:00
parent
2d6883c432
commit
14444c1c7f
@ -54,6 +54,7 @@ static const struct mqtt_connect_client_info_t mqtt_client_info =
|
|||||||
100, /* keep alive */
|
100, /* keep alive */
|
||||||
NULL, /* will_topic */
|
NULL, /* will_topic */
|
||||||
NULL, /* will_msg */
|
NULL, /* will_msg */
|
||||||
|
0, /* will_msg_len */
|
||||||
0, /* will_qos */
|
0, /* will_qos */
|
||||||
0 /* will_retain */
|
0 /* will_retain */
|
||||||
#if LWIP_ALTCP && LWIP_ALTCP_TLS
|
#if LWIP_ALTCP && LWIP_ALTCP_TLS
|
||||||
|
@ -1337,9 +1337,16 @@ mqtt_client_connect(mqtt_client_t *client, const ip_addr_t *ip_addr, u16_t port,
|
|||||||
LWIP_ERROR("mqtt_client_connect: client_info->will_topic length overflow", len <= 0xFF, return ERR_VAL);
|
LWIP_ERROR("mqtt_client_connect: client_info->will_topic length overflow", len <= 0xFF, return ERR_VAL);
|
||||||
LWIP_ERROR("mqtt_client_connect: client_info->will_topic length must be > 0", len > 0, return ERR_VAL);
|
LWIP_ERROR("mqtt_client_connect: client_info->will_topic length must be > 0", len > 0, return ERR_VAL);
|
||||||
will_topic_len = (u8_t)len;
|
will_topic_len = (u8_t)len;
|
||||||
|
if (client_info->will_msg_len == 0)
|
||||||
|
{
|
||||||
len = strlen(client_info->will_msg);
|
len = strlen(client_info->will_msg);
|
||||||
LWIP_ERROR("mqtt_client_connect: client_info->will_msg length overflow", len <= 0xFF, return ERR_VAL);
|
LWIP_ERROR("mqtt_client_connect: client_info->will_msg length overflow", len <= 0xFF, return ERR_VAL);
|
||||||
will_msg_len = (u8_t)len;
|
will_msg_len = (u8_t)len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
will_msg_len = client_info->will_msg_len;
|
||||||
|
}
|
||||||
len = remaining_length + 2 + will_topic_len + 2 + will_msg_len;
|
len = remaining_length + 2 + will_topic_len + 2 + will_msg_len;
|
||||||
LWIP_ERROR("mqtt_client_connect: remaining_length overflow", len <= 0xFFFF, return ERR_VAL);
|
LWIP_ERROR("mqtt_client_connect: remaining_length overflow", len <= 0xFFFF, return ERR_VAL);
|
||||||
remaining_length = (u16_t)len;
|
remaining_length = (u16_t)len;
|
||||||
|
@ -79,6 +79,8 @@ struct mqtt_connect_client_info_t {
|
|||||||
const char* will_topic;
|
const char* will_topic;
|
||||||
/** will_msg, see will_topic */
|
/** will_msg, see will_topic */
|
||||||
const char* will_msg;
|
const char* will_msg;
|
||||||
|
/** will_msg length, 0 to compute length from will_msg string */
|
||||||
|
u8_t will_msg_len;
|
||||||
/** will_qos, see will_topic */
|
/** will_qos, see will_topic */
|
||||||
u8_t will_qos;
|
u8_t will_qos;
|
||||||
/** will_retain, see will_topic */
|
/** will_retain, see will_topic */
|
||||||
|
@ -77,7 +77,7 @@ START_TEST(basic_connect)
|
|||||||
"dumm",
|
"dumm",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
10,
|
10,
|
||||||
NULL, NULL, 0, 0
|
NULL, NULL, 0, 0, 0
|
||||||
};
|
};
|
||||||
struct pbuf *p;
|
struct pbuf *p;
|
||||||
unsigned char rxbuf[] = {0x20, 0x02, 0x00, 0x00};
|
unsigned char rxbuf[] = {0x20, 0x02, 0x00, 0x00};
|
||||||
|
Loading…
Reference in New Issue
Block a user