This commit is contained in:
Dane Walton 2020-10-15 12:51:45 -07:00
Родитель 10aac20a4e
Коммит 407c06f59a
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -48,6 +48,7 @@ typedef void(*ON_MQTT_ERROR_CALLBACK)(MQTT_CLIENT_HANDLE handle, MQTT_CLIENT_EVE
typedef void(*ON_MQTT_MESSAGE_RECV_CALLBACK)(MQTT_MESSAGE_HANDLE msgHandle, void* callbackCtx);
typedef void(*ON_MQTT_DISCONNECTED_CALLBACK)(void* callbackCtx);
MOCKABLE_FUNCTION(, void, mqtt_client_close_xio, MQTT_CLIENT_HANDLE, mqtt_client);
MOCKABLE_FUNCTION(, MQTT_CLIENT_HANDLE, mqtt_client_init, ON_MQTT_MESSAGE_RECV_CALLBACK, msgRecv, ON_MQTT_OPERATION_CALLBACK, opCallback, void*, opCallbackCtx, ON_MQTT_ERROR_CALLBACK, onErrorCallBack, void*, errorCBCtx);
MOCKABLE_FUNCTION(, void, mqtt_client_deinit, MQTT_CLIENT_HANDLE, handle);

Просмотреть файл

@ -945,6 +945,14 @@ static void recvCompleteCallback(void* context, CONTROL_PACKET_TYPE packet, int
}
}
void mqtt_client_close_xio(MQTT_CLIENT_HANDLE handle)
{
MQTT_CLIENT* mqtt_client = (MQTT_CLIENT*)handle;
(void)xio_close(mqtt_client->xioHandle, on_connection_closed, mqtt_client);
// Clear the handle because we don't use it anymore
mqtt_client->xioHandle = NULL;
}
MQTT_CLIENT_HANDLE mqtt_client_init(ON_MQTT_MESSAGE_RECV_CALLBACK msgRecv, ON_MQTT_OPERATION_CALLBACK operation_cb, void* opCallbackCtx, ON_MQTT_ERROR_CALLBACK onErrorCallBack, void* errorCBCtx)
{
MQTT_CLIENT* result;