From f1791f5219337c9622da77fda69fa26c527f5eb3 Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Thu, 15 Sep 2022 11:23:02 +0900 Subject: [PATCH] add initialization of members --- common/MainLoopHandler.cc | 2 +- modules/webrtc/MqttServer.cc | 3 ++- modules/webrtc/WebRtcRoom.h | 2 +- src/AITTImpl.cc | 5 +++-- src/aitt_c.cc | 3 +-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common/MainLoopHandler.cc b/common/MainLoopHandler.cc index 747a6bc..0c7a691 100644 --- a/common/MainLoopHandler.cc +++ b/common/MainLoopHandler.cc @@ -180,7 +180,7 @@ void MainLoopHandler::DestroyNotify(gpointer data) delete cb_data; } -MainLoopHandler::MainLoopCbData::MainLoopCbData() : result(OK), fd(-1) +MainLoopHandler::MainLoopCbData::MainLoopCbData() : data(nullptr), result(OK), fd(-1), ctx(nullptr) { } diff --git a/modules/webrtc/MqttServer.cc b/modules/webrtc/MqttServer.cc index 726161e..b8a9c45 100644 --- a/modules/webrtc/MqttServer.cc +++ b/modules/webrtc/MqttServer.cc @@ -22,7 +22,8 @@ #define MQTT_HANDLER_MGMT_QOS 2 MqttServer::MqttServer(const Config &config) - : mq(new aitt::MQProxy(config.GetLocalId(), AittOption(true, false))) + : mq(new aitt::MQProxy(config.GetLocalId(), AittOption(true, false))), + connection_state_(ConnectionState::Disconnected) { broker_ip_ = config.GetBrokerIp(); broker_port_ = config.GetBrokerPort(); diff --git a/modules/webrtc/WebRtcRoom.h b/modules/webrtc/WebRtcRoom.h index fabeb1e..2df2d62 100644 --- a/modules/webrtc/WebRtcRoom.h +++ b/modules/webrtc/WebRtcRoom.h @@ -30,7 +30,7 @@ class WebRtcRoom { JOINED, }; WebRtcRoom() = delete; - WebRtcRoom(const std::string &room_id) : id_(room_id){}; + explicit WebRtcRoom(const std::string &room_id) : id_(room_id), state_(State::JOINNING){}; ~WebRtcRoom(); void setRoomState(State current) { state_ = current; } State getRoomState(void) const { return state_; }; diff --git a/src/AITTImpl.cc b/src/AITTImpl.cc index 775972a..e976dab 100644 --- a/src/AITTImpl.cc +++ b/src/AITTImpl.cc @@ -35,6 +35,7 @@ AITT::Impl::Impl(AITT &parent, const std::string &id, const std::string &my_ip, const AittOption &option) : public_api(parent), id_(id), + mqtt_broker_port_(0), mq(new MQProxy(id, option)), discovery(id, option), reply_id(0), @@ -299,8 +300,8 @@ int AITT::Impl::PublishWithReply(const std::string &topic, const void *data, con Subscribe( replyTopic, - [this, cb]( - MSG *sub_msg, const void *sub_data, const size_t sub_datalen, void *sub_cbdata) { + [this, cb](MSG *sub_msg, const void *sub_data, const size_t sub_datalen, + void *sub_cbdata) { if (sub_msg->IsEndSequence()) { try { Unsubscribe(sub_msg->GetID()); diff --git a/src/aitt_c.cc b/src/aitt_c.cc index d2f68db..9e175f2 100644 --- a/src/aitt_c.cc +++ b/src/aitt_c.cc @@ -24,7 +24,7 @@ using namespace aitt; struct aitt_handle { - aitt_handle() : aitt(nullptr) {} + aitt_handle() : aitt(nullptr), connected(false), custom_broker(false) {} AITT *aitt; bool connected; bool custom_broker; @@ -58,7 +58,6 @@ API aitt_h aitt_new(const char *id, aitt_option_h option) handle = new aitt_handle(); handle->aitt = new AITT(valid_id, valid_ip, aitt_option); - handle->connected = false; handle->custom_broker = custom_broker; } catch (std::exception &e) { ERR("new() Fail(%s)", e.what()); -- 2.7.4