[Konversation-devel] [Bug 241858] Too many PING sent when using an irc proxy

Eike Hein hein at kde.org
Thu Jun 24 21:01:16 CEST 2010


https://bugs.kde.org/show_bug.cgi?id=241858


Eike Hein <hein at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED




--- Comment #4 from Eike Hein <hein kde org>  2010-06-24 21:01:12 ---
commit 86dc0790b28e3793b9ed6f738ffda07fe8da3a23
Author: Eike Hein <hein at kde.org>
Date:   Thu Jun 24 21:00:49 2010 +0200

    Don't send PING in response to PONG if a PING is already scheduled.

    Avoids getting kicked off a server for flooding with multiple clients
    connected to a bouncer that forwards PONGs to all of them.

    Patch by Alexandre Becoulet, many thanks!

    BUG:241858

diff --git a/ChangeLog b/ChangeLog
index 5d23067..c28d3b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,10 @@ Changes since 1.3:
 * Fixed a bug that could cause outdated status information for nicks to be
   displayed in channel nickname lists after a reconnect.
 * Efficiency improvements for channel join.
+* Don't send PING in response to PONG if another PING is already scheduled
+  to be sent in the future. This avoids getting kicked off a server for
+  flooding when multiple clients are connected to a bouncer that forwards
+  PONGs to all of them.


 Changes from 1.3-beta1 to 1.3:
diff --git a/src/commit.h b/src/commit.h
index 778619a..7c73225 100644
--- a/src/commit.h
+++ b/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 4052
+#define COMMIT 4053
 #endif
diff --git a/src/irc/server.cpp b/src/irc/server.cpp
index 2a8255c..bbb4f84 100644
--- a/src/irc/server.cpp
+++ b/src/irc/server.cpp
@@ -240,6 +240,7 @@ void Server::initTimers()
     m_notifyTimer.setObjectName("notify_timer");
     m_notifyTimer.setSingleShot(true);
     m_incomingTimer.setObjectName("incoming_timer");
+    m_pingSendTimer.setSingleShot(true);
 }

 void Server::connectSignals()
@@ -248,6 +249,7 @@ void Server::connectSignals()
     connect(&m_incomingTimer, SIGNAL(timeout()), this,
SLOT(processIncomingData()));
     connect(&m_notifyTimer, SIGNAL(timeout()), this, SLOT(notifyTimeout()));
     connect(&m_pingResponseTimer, SIGNAL(timeout()), this,
SLOT(updateLongPongLag()));
+    connect(&m_pingSendTimer, SIGNAL(timeout()), this, SLOT(sendPing()));

     // OutputFilter
     connect(getOutputFilter(), SIGNAL(requestDccSend()),
this,SLOT(requestDccSend()), Qt::QueuedConnection);
@@ -732,7 +734,7 @@ void Server::connectionEstablished(const QString& ownHost)
     requestUserhost(getNickname());

     // Start the PINGPONG match
-    QTimer::singleShot(1000 /*1 sec*/, this, SLOT(sendPing()));
+    m_pingSendTimer.start(1000 /*1 sec*/);

     // Recreate away state if we were set away prior to a reconnect.
     if (m_away)
@@ -3792,14 +3794,18 @@ void Server::sendPing()

 void Server::pongReceived()
 {
+    // ignore unrequested PONGs
+    if (m_pingSendTimer.isActive())
+        return;
+
     m_currentLag = m_lagTime.elapsed();
     m_inputFilter.setLagMeasuring(false);
     m_pingResponseTimer.stop();

     emit serverLag(this, m_currentLag);

-    // Send another PING in 60 seconds
-    QTimer::singleShot(60000 /*60 sec*/, this, SLOT(sendPing()));
+    // Send another PING in 60 seconds 
+    m_pingSendTimer.start(60000 /*60 sec*/);
 }

 void Server::updateLongPongLag()
diff --git a/src/irc/server.h b/src/irc/server.h
index d2807a4..049970c 100644
--- a/src/irc/server.h
+++ b/src/irc/server.h
@@ -801,6 +801,8 @@ class Server : public QObject
         QTime m_lagTime;
         /// Updates the gui when the lag gets too high
         QTimer m_pingResponseTimer;
+        /// Wait before sending the next PING
+        QTimer m_pingSendTimer;

         /// Previous ISON reply of the server, needed for comparison with the
next reply
         QStringList m_prevISONList;

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Konversation-devel mailing list