incubator-ftpserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r512310 - in /incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener: FtpProtocolHandler.java mina/MinaFtpProtocolHandler.java
Date Tue, 27 Feb 2007 16:36:15 GMT
Author: ngn
Date: Tue Feb 27 08:36:13 2007
New Revision: 512310

URL: http://svn.apache.org/viewvc?view=rev&rev=512310
Log:
Fixing bug where setLogout on statisics was not called during a client disconnect if using
the MinaListener (FTPSERVER-76)

Modified:
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/FtpProtocolHandler.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/MinaFtpProtocolHandler.java

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/FtpProtocolHandler.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/FtpProtocolHandler.java?view=diff&rev=512310&r1=512309&r2=512310
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/FtpProtocolHandler.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/FtpProtocolHandler.java
Tue Feb 27 08:36:13 2007
@@ -131,7 +131,10 @@
         // call Ftplet.onDisconnect() method.
         try {
             Ftplet ftpletContainer = serverContext.getFtpletContainer();
-            ftpletContainer.onDisconnect(session, writer);
+            
+            if(ftpletContainer != null) {
+                ftpletContainer.onDisconnect(session, writer);
+            }
         }
         catch(Exception ex) {
             LOG.warn("RequestHandler.close()", ex);
@@ -151,9 +154,15 @@
             // logout if necessary and notify statistics
             if(session.isLoggedIn()) {
                 session.setLogout();
-                ftpStat.setLogout(connection);
+                
+                if(ftpStat != null) {
+                    ftpStat.setLogout(connection);
+                }
+            }
+            
+            if(ftpStat != null) {
+                ftpStat.setCloseConnection(connection);
             }
-            ftpStat.setCloseConnection(connection);
             
             // clear request
             session.clear();

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/MinaFtpProtocolHandler.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/MinaFtpProtocolHandler.java?view=diff&rev=512310&r1=512309&r2=512310
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/MinaFtpProtocolHandler.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/MinaFtpProtocolHandler.java
Tue Feb 27 08:36:13 2007
@@ -37,7 +37,8 @@
  */
 public class MinaFtpProtocolHandler extends IoHandlerAdapter
 {
-    
+
+
     private static final String OUTPUT_KEY = "output";
     private static final String CONNECTION_KEY = "connection";
     
@@ -73,6 +74,14 @@
         MinaFtpResponseOutput output = (MinaFtpResponseOutput) session.getAttribute(OUTPUT_KEY);
         
         protocolHandler.onConnectionOpened(connection, (FtpSessionImpl)connection.getSession(),
output);
+    }
+    
+    
+    public void sessionClosed(IoSession session) throws Exception {
+        MinaConnection connection = (MinaConnection) session.getAttribute(CONNECTION_KEY);
+        MinaFtpResponseOutput output = (MinaFtpResponseOutput) session.getAttribute(OUTPUT_KEY);
+        
+        protocolHandler.onConnectionClosed(connection, (FtpSessionImpl)connection.getSession(),
output);
     }
     
     public void messageReceived( IoSession session, Object message ) throws IOException,
FtpException



Mime
View raw message