Commit 125cd258 authored by DanmeiChen's avatar DanmeiChen
Browse files

fix restart core failed

parent f564f201
......@@ -2902,6 +2902,10 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
LinphoneStatus linphone_core_start (LinphoneCore *lc) {
try {
//Force change of status to LinphoneGlobalOff, otherwise restarting it will fail
if (lc->state == LinphoneGlobalShutdown) {
_linphone_core_stop_async_end(lc);
}
if (lc->state == LinphoneGlobalOn) {
bctbx_warning("Core is already started, skipping...");
return -1;
......@@ -7273,7 +7277,8 @@ bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc) {
}
void linphone_core_start_dtmf_stream(LinphoneCore* lc) {
L_GET_PRIVATE_FROM_C_OBJECT(lc)->getToneManager()->linphoneCoreStartDtmfStream();
if (linphone_core_get_global_state(lc) != LinphoneGlobalShutdown)
L_GET_PRIVATE_FROM_C_OBJECT(lc)->getToneManager()->linphoneCoreStartDtmfStream();
}
void linphone_core_stop_ringing(LinphoneCore* lc) {
......
......@@ -42,6 +42,7 @@ void ImdnMessagePrivate::setState (ChatMessage::State newState) {
static_pointer_cast<ChatRoom>(context.chatRoom)->getPrivate()->getImdnHandler()->onImdnMessageDelivered(q->getSharedFromThis());
} else if (newState == ChatMessage::State::NotDelivered) {
// TODO: Maybe we should retry sending the IMDN message if we get an error here
static_pointer_cast<ChatRoom>(context.chatRoom)->getPrivate()->getImdnHandler()->onImdnMessageNotDelivered(q->getSharedFromThis());
}
}
......
......@@ -104,6 +104,10 @@ void Imdn::onImdnMessageDelivered (const std::shared_ptr<ImdnMessage> &message)
sentImdnMessages.remove(message);
}
void Imdn::onImdnMessageNotDelivered (const std::shared_ptr<ImdnMessage> &message) {
sentImdnMessages.remove(message);
}
bool Imdn::hasUndeliveredImdnMessage() {
return !(sentImdnMessages.empty() && deliveredMessages.empty() && displayedMessages.empty() && nonDeliveredMessages.empty());
}
......
......@@ -62,6 +62,7 @@ public:
void notifyDisplay (const std::shared_ptr<ChatMessage> &message);
void onImdnMessageDelivered (const std::shared_ptr<ImdnMessage> &message);
void onImdnMessageNotDelivered (const std::shared_ptr<ImdnMessage> &message);
bool hasUndeliveredImdnMessage();
// CoreListener
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment