summaryrefslogtreecommitdiff
path: root/protocols/MRA/src/Mra_proto.cpp
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2016-06-16 22:40:22 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2016-06-16 22:40:22 +0000
commit2f30a747ab285281620417f8848f40478d3e1705 (patch)
treede95449fd1fa2a793b5aeb50ff959e57963dcfe0 /protocols/MRA/src/Mra_proto.cpp
parenteb774f8437753724bda816f0d274b7639a6706d0 (diff)
MRA: reduce CPU usage
git-svn-id: http://svn.miranda-ng.org/main/trunk@16995 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Mra_proto.cpp')
-rw-r--r--protocols/MRA/src/Mra_proto.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index df1b11d455..7ad1e79e70 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -209,7 +209,7 @@ DWORD CMraProto::MraNetworkDispatcher()
mrim_packet_header_t *pmaHeader;
NETLIBSELECT nls = { sizeof(nls) };
- nls.dwTimeout = NETLIB_SELECT_TIMEOUT;
+ nls.dwTimeout = 1000;
nls.hReadConns[0] = m_hConnection;
lpbBufferRcv = (LPBYTE)mir_calloc(dwRcvBuffSize);
@@ -219,6 +219,7 @@ DWORD CMraProto::MraNetworkDispatcher()
MraSendCMD(MRIM_CS_HELLO, NULL, 0);
m_dwThreadWorkerLastPingTime = GetTickCount();
while (m_iStatus != ID_STATUS_OFFLINE && bContinue) {
+ nls.dwTimeout = (m_dwPingPeriod * 1000);
DWORD dwSelectRet = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls);
if (SOCKET_ERROR == dwSelectRet) {
if (m_iStatus != ID_STATUS_OFFLINE) {
@@ -231,7 +232,8 @@ DWORD CMraProto::MraNetworkDispatcher()
m_dwThreadWorkerLastPingTime = GetTickCount();
/* Server ping. */
if (m_dwNextPingSendTickTime <= m_dwThreadWorkerLastPingTime) {
- m_dwNextPingSendTickTime = (m_dwThreadWorkerLastPingTime + (m_dwPingPeriod * 1000));
+ nls.dwTimeout = (m_dwPingPeriod * 1000);
+ m_dwNextPingSendTickTime = (m_dwThreadWorkerLastPingTime + nls.dwTimeout);
MraSendCMD(MRIM_CS_PING, NULL, 0);
}
{ /* Remove old items from send queue. */