Author: norman
Date: Mon Jan 18 21:17:22 2010
New Revision: 900564

URL: http://svn.apache.org/viewvc?rev=900564&view=rev
Log:
Only write error back to client if the session is still connected

Modified:
    
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPIoHandler.java

Modified: 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPIoHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPIoHandler.java?rev=900564&r1=900563&r2=900564&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPIoHandler.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPIoHandler.java
 Mon Jan 18 21:17:22 2010
@@ -80,7 +80,8 @@
         logger.error("Caught exception: " + session.getCurrentWriteMessage(),
                 exception);
         
-        session.write(new SMTPResponse(SMTPRetCode.LOCAL_ERROR, "Unable to 
process smtp request"));
+        // write an error to the client if the session is stil connected
+        if (session.isConnected()) session.write(new 
SMTPResponse(SMTPRetCode.LOCAL_ERROR, "Unable to process smtp request"));
     }
 
     /**
@@ -93,8 +94,8 @@
         } else {
             smtpSession= new SMTPSessionImpl(conf, logger, session, 
contextFactory.newInstance());
         }
-        // Add attributes
-
+        
+        // Add attribute
         session.setAttribute(SMTPSessionImpl.SMTP_SESSION,smtpSession);
     }
 
@@ -105,7 +106,7 @@
     public void sessionIdle(IoSession session, IdleStatus status)
             throws Exception {
         logger.debug("Connection timed out");
-        session.write("Connection timeout");
+        //session.write("Connection timeout");
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to