summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-04-07 22:00:24 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-04-07 22:01:44 +0300
commitc429dcfc34b0efb8022ebabcdc3b10925a685868 (patch)
tree6b73eac98ea76075e1d65837a06efc6ee534f834
parent5811219420fdedef8941584ef70fec403d012e4e (diff)
protocols: jabber: xep-0198
- improoved resume logic
-rwxr-xr-xprotocols/JabberG/src/jabber_strm_mgmt.cpp9
-rwxr-xr-xprotocols/JabberG/src/jabber_strm_mgmt.h1
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp6
3 files changed, 16 insertions, 0 deletions
diff --git a/protocols/JabberG/src/jabber_strm_mgmt.cpp b/protocols/JabberG/src/jabber_strm_mgmt.cpp
index 7a02b20471..485174e42d 100755
--- a/protocols/JabberG/src/jabber_strm_mgmt.cpp
+++ b/protocols/JabberG/src/jabber_strm_mgmt.cpp
@@ -164,6 +164,8 @@ void strm_mgmt::CheckStreamFeatures(HXML node)
void strm_mgmt::CheckState()
{
+ if (m_bStrmMgmtEnabled)
+ return;
if (!m_bStrmMgmtPendingEnable)
return;
EnableStrmMgmt();
@@ -201,6 +203,8 @@ void strm_mgmt::HandleIncommingNode(HXML node)
void strm_mgmt::EnableStrmMgmt()
{
+ if (m_bStrmMgmtEnabled)
+ return;
if (m_sStrmMgmtResumeId.empty())
{
XmlNode enable_sm(L"enable");
@@ -241,4 +245,9 @@ void strm_mgmt::RequestAck()
bool strm_mgmt::IsSessionResumed()
{
return bSessionResumed;
+}
+
+bool strm_mgmt::IsResumeIdPresent()
+{
+ return !m_sStrmMgmtResumeId.empty();
} \ No newline at end of file
diff --git a/protocols/JabberG/src/jabber_strm_mgmt.h b/protocols/JabberG/src/jabber_strm_mgmt.h
index 1791afd8eb..03d3cd42e0 100755
--- a/protocols/JabberG/src/jabber_strm_mgmt.h
+++ b/protocols/JabberG/src/jabber_strm_mgmt.h
@@ -55,6 +55,7 @@ public:
void SendAck();
void RequestAck();
bool IsSessionResumed();
+ bool IsResumeIdPresent();
};
#endif //JABBER_STRM_MGMT_H \ No newline at end of file
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 7199b5181c..c032af1727 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -760,6 +760,12 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData *info)
return;
}
+ if (m_bEnableStreamMgmt) //resume should be done here
+ {
+ if (m_StrmMgmt.IsResumeIdPresent())
+ m_StrmMgmt.CheckState();
+ }
+
// mechanisms are not defined.
if (info->auth) { //We are already logged-in
info->send(