You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2011/08/24 22:05:43 UTC

svn commit: r1161261 - /james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java

Author: norman
Date: Wed Aug 24 20:05:42 2011
New Revision: 1161261

URL: http://svn.apache.org/viewvc?rev=1161261&view=rev
Log:
Make sure we close after flush buffers

Modified:
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java?rev=1161261&r1=1161260&r2=1161261&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPChannelUpstreamHandler.java Wed Aug 24 20:05:42 2011
@@ -30,7 +30,9 @@ import org.apache.james.protocols.smtp.S
 import org.apache.james.protocols.smtp.SMTPRetCode;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.smtpserver.SMTPConstants;
+import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFutureListener;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.ChannelUpstreamHandler;
 import org.jboss.netty.channel.ExceptionEvent;
@@ -78,7 +80,7 @@ public class SMTPChannelUpstreamHandler 
             ctx.getChannel().write(new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED, "Line length exceeded. See RFC 2821 #4.5.3.1."));
         } else {
             if (channel.isConnected()) {
-                ctx.getChannel().write(new SMTPResponse(SMTPRetCode.LOCAL_ERROR, "Unable to process request"));
+                ctx.getChannel().write(new SMTPResponse(SMTPRetCode.LOCAL_ERROR, "Unable to process request")).addListener(ChannelFutureListener.CLOSE);
             }
             SMTPSession smtpSession = (SMTPSession) attributes.get(channel);
             if (smtpSession != null) {
@@ -86,8 +88,7 @@ public class SMTPChannelUpstreamHandler 
             } else {
                 logger.debug("Unable to process request", e.getCause());
             }
-            cleanup(channel);
-            channel.close();
+            cleanup(channel);            
         }
     }
 



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