You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/03/08 05:44:29 UTC

[james-project] 19/30: Revert "JAMES-3509 IMAP connection metric was not all the time decreased"

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 1610afba7612de5ff92ce8f136544655b333b230
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Mar 3 15:06:29 2021 +0700

    Revert "JAMES-3509 IMAP connection metric was not all the time decreased"
    
    This reverts commit 3bdd6cb361c68d86e682d4e37600d1fc1db359bd.
---
 .../netty/ImapChannelUpstreamHandler.java          | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
index 373fc25..96f31d7 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
@@ -167,19 +167,15 @@ public class ImapChannelUpstreamHandler extends SimpleChannelUpstreamHandler imp
                 if (imapSession != null) {
                     imapSession.logout();
                 }
-                disconnectClient(ctx);
 
-            }
-        }
-    }
+                // Make sure we close the channel after all the buffers were flushed out
+                Channel channel = ctx.getChannel();
+                if (channel.isConnected()) {
+                    channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
+                }
 
-    private void disconnectClient(ChannelHandlerContext ctx) {
-        // Make sure we close the channel after all the buffers were flushed out
-        Channel channel = ctx.getChannel();
-        if (channel.isConnected()) {
-            channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
+            }
         }
-        imapConnectionsMetric.decrement();
     }
 
     @Override
@@ -202,7 +198,11 @@ public class ImapChannelUpstreamHandler extends SimpleChannelUpstreamHandler imp
                 processor.process(message, responseEncoder, session);
 
                 if (session.getState() == ImapSessionState.LOGOUT) {
-                    disconnectClient(ctx);
+                    // Make sure we close the channel after all the buffers were flushed out
+                    Channel channel = ctx.getChannel();
+                    if (channel.isConnected()) {
+                        channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
+                    }
                 }
                 final IOException failure = responseEncoder.getFailure();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org