This is an automated email from the ASF dual-hosted git repository.

xyz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new f37bf92  fix: ignore ping command in connection keepalive logic (#480)
f37bf92 is described below

commit f37bf928e61296a8416693aa2a6afbc0ca2c8a82
Author: erobot <ero...@users.noreply.github.com>
AuthorDate: Wed Apr 23 10:12:45 2025 +0800

    fix: ignore ping command in connection keepalive logic (#480)
    
    Fixes #479
    
    ### Motivation
    
    The current keepalive logic is too lenient – merely receiving ping commands 
can keep the connection alive.
    
    ### Modifications
    
    Ignore ping command in connection keepalive logic.
---
 lib/ClientConnection.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/ClientConnection.cc b/lib/ClientConnection.cc
index 2037722..d036491 100644
--- a/lib/ClientConnection.cc
+++ b/lib/ClientConnection.cc
@@ -924,7 +924,9 @@ void ClientConnection::handleIncomingCommand(BaseCommand& 
incomingCmd) {
         case Ready: {
             // Since we are receiving data from the connection, we are 
assuming that for now the
             // connection is still working well.
-            havePendingPingRequest_ = false;
+            if (incomingCmd.type() != BaseCommand::PING) {
+                havePendingPingRequest_ = false;
+            }
 
             // Handle normal commands
             switch (incomingCmd.type()) {

Reply via email to