diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2018-04-06 09:56:43 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2018-04-06 09:56:43 +0300 |
commit | dbc713b6a5308cd964def21eec6913177754bbd2 (patch) | |
tree | cc90fd0798c00d3ce5ff04751933d4e967bac601 /protocols/JabberG/src/jabber_thread.cpp | |
parent | f748401840ee648552825c99170c7d53d1b2ff43 (diff) |
protocols: jabber: xep-0198
- a bit improoved logic
- implemented "keep-alive" like ack request (currently sema logick as ping, should also work with ping disabled, ping is not necessary if strm_mgmt enabled)
Diffstat (limited to 'protocols/JabberG/src/jabber_thread.cpp')
-rwxr-xr-x | protocols/JabberG/src/jabber_thread.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 243eb3e39f..7199b5181c 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -421,15 +421,22 @@ LBL_FatalError: int nSelRes = Netlib_Select(&nls);
if (nSelRes == -1) // error
break;
- else if (nSelRes == 0 && m_bSendKeepAlive) {
- if (info.jabberServerCaps & JABBER_CAPS_PING) {
- CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, nullptr, 0, -1, this);
- pInfo->SetTimeout(m_iConnectionKeepAliveTimeout);
- info.send(XmlNodeIq(pInfo) << XATTR(L"from", info.fullJID) << XCHILDNS(L"ping", JABBER_FEAT_PING));
+ else if (nSelRes == 0)
+ {
+ if (m_bSendKeepAlive)
+ {
+ if (info.jabberServerCaps & JABBER_CAPS_PING) {
+ CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnPingReply, JABBER_IQ_TYPE_GET, nullptr, 0, -1, this);
+ pInfo->SetTimeout(m_iConnectionKeepAliveTimeout);
+ info.send(XmlNodeIq(pInfo) << XATTR(L"from", info.fullJID) << XCHILDNS(L"ping", JABBER_FEAT_PING));
+ }
}
- else info.send(" \t ");
- continue;
- } }
+ else
+ info.send(" \t "); //TODO: why do we need this ?
+ if (m_bEnableStreamMgmt)
+ m_StrmMgmt.RequestAck();
+ }
+ }
int recvResult = info.recv(info.buffer + datalen, jabberNetworkBufferSize - datalen);
debugLogA("recvResult = %d", recvResult);
|