mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 15:36:51 +01:00
Merge pull request #71 from eclipse/develop
Bugfix of Gateway can't receive MQTT packets with no payload.
This commit is contained in:
@@ -204,6 +204,8 @@ int MQTTGWPacket::recv(Network* network)
|
|||||||
multiplier *= 128;
|
multiplier *= 128;
|
||||||
} while ((c & 128) != 0);
|
} while ((c & 128) != 0);
|
||||||
|
|
||||||
|
if ( _remainingLength > 0 )
|
||||||
|
{
|
||||||
/* allocate buffer */
|
/* allocate buffer */
|
||||||
_data = (unsigned char*)calloc(_remainingLength, 1);
|
_data = (unsigned char*)calloc(_remainingLength, 1);
|
||||||
if ( !_data )
|
if ( !_data )
|
||||||
@@ -222,6 +224,7 @@ int MQTTGWPacket::recv(Network* network)
|
|||||||
{
|
{
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 1 + len + _remainingLength;
|
return 1 + len + _remainingLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ void BrokerSendTask::run()
|
|||||||
if ( !rc )
|
if ( !rc )
|
||||||
{
|
{
|
||||||
/* disconnect the broker and the client */
|
/* disconnect the broker and the client */
|
||||||
WRITELOG("%s BrokerSendTask can't connect to the broker. %s%s\n",
|
WRITELOG("%s BrokerSendTask: %s can't connect to the broker. errno=%d %s %s\n",
|
||||||
ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER);
|
ERRMSG_HEADER, client->getClientId(), errno, strerror(errno), ERRMSG_FOOTER);
|
||||||
delete ev;
|
delete ev;
|
||||||
client->getNetwork()->close();
|
client->getNetwork()->close();
|
||||||
continue;
|
continue;
|
||||||
@@ -120,8 +120,8 @@ void BrokerSendTask::run()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WRITELOG("%s BrokerSendTask can't send a packet to the broker errno=%d %s%s\n",
|
WRITELOG("%s BrokerSendTask: %s can't send a packet to the broker. errno=%d %s %s\n",
|
||||||
ERRMSG_HEADER, rc == -1 ? errno : 0, client->getClientId(), ERRMSG_FOOTER);
|
ERRMSG_HEADER, client->getClientId(), rc == -1 ? errno : 0, strerror(errno), ERRMSG_FOOTER);
|
||||||
client->getNetwork()->close();
|
client->getNetwork()->close();
|
||||||
|
|
||||||
/* Disconnect the client */
|
/* Disconnect the client */
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ bool Network::connect(const char* host, const char* port, const char* caPath, co
|
|||||||
throw false;
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!SSL_CTX_load_verify_locations(_ctx, caFile, caPath))
|
if (!SSL_CTX_load_verify_locations(_ctx, caFile, caPath))
|
||||||
{
|
{
|
||||||
ERR_error_string_n(ERR_get_error(), errmsg, sizeof(errmsg));
|
ERR_error_string_n(ERR_get_error(), errmsg, sizeof(errmsg));
|
||||||
|
|||||||
Reference in New Issue
Block a user