diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-16 11:17:06 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-16 11:17:06 +0000 |
commit | 0d0add7b1272241fe4c90f09c7ca8be1762a3c6d (patch) | |
tree | f3d5e1a56706510ed5f1ab991769ea62368f817f /protocols/IcqOscarJ/src/chan_05ping.cpp | |
parent | b8b358f558e4d262012985a50ae8b979609da1c3 (diff) |
fix for keep-alive in ICQ
git-svn-id: http://svn.miranda-ng.org/main/trunk@9827 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src/chan_05ping.cpp')
-rw-r--r-- | protocols/IcqOscarJ/src/chan_05ping.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp index 5fe2aaf9a7..8e735337e8 100644 --- a/protocols/IcqOscarJ/src/chan_05ping.cpp +++ b/protocols/IcqOscarJ/src/chan_05ping.cpp @@ -32,27 +32,27 @@ void CIcqProto::handlePingChannel(BYTE *buf, WORD datalen) void CIcqProto::StartKeepAlive(serverthread_info *info)
{
if (getByte("KeepAlive", DEFAULT_KEEPALIVE_ENABLED))
- info->iKeepalive = getDword("KeepAliveInterval", KEEPALIVE_INTERVAL);
+ info->tmPing = time(0) + KEEPALIVE_INTERVAL;
else
- info->iKeepalive = -1;
+ info->tmPing = -1;
}
void CIcqProto::StopKeepAlive(serverthread_info *info)
{
- info->iKeepalive = -1;
+ info->tmPing = -1;
}
void CIcqProto::CheckKeepAlive(serverthread_info *info)
{
- if (info->iKeepalive != -1) {
- if (info->iKeepalive == 0) {
- // Send a keep alive packet to server
- icq_packet packet = { 0 };
- write_flap(&packet, ICQ_PING_CHAN);
- sendServPacket(&packet);
+ if (info->tmPing == -1)
+ return;
- StartKeepAlive(info);
- }
- else info->iKeepalive--;
+ if (time(0) >= info->tmPing) {
+ // Send a keep alive packet to server
+ icq_packet packet = { 0 };
+ write_flap(&packet, ICQ_PING_CHAN);
+ sendServPacket(&packet);
+
+ StartKeepAlive(info);
}
}
|