Connection is closed by remote server without waiting for client
----------------------------------------------------------------

                 Key: FTPSERVER-112
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-112
             Project: FtpServer
          Issue Type: Bug
          Components: Core
            Reporter: Rico Neubauer


FTP-Server is using MinaListener as listener class and the corresponding 
MinaFtpResponseOutput to write the replies.

When sending QUIT to the server, a reply "200 Goodbye." is send back and after 
that the connection is closed from the server. The problem here is that the 
reply is sent asynchronously and the connection is closed before this happen.

MinaFtpResponseOutput#write:
public void write(FtpReply response) throws IOException {
    session.write(response);
}

where session is IoSession interface. The following is the javadoc for this 
method:
Writes the specified message to remote peer. This operation is asynchronous;
[EMAIL PROTECTED] IoHandler#messageSent(IoSession, Object)} will be invoked 
when the message is actually sent to remote peer. You can also wait for the 
returned [EMAIL PROTECTED] WriteFuture} if you want to wait for the message 
actually written.

And in the end the Apache QUIT impl:
session.resetState();
out.write(FtpReplyUtil.translate(session,FtpReply.REPLY_221_CLOSING_CONTROL_CONNECTION,
 "QUIT", null));   
connection.getServerContext().getConnectionManager().closeConnection(connection);

Bottom line: Before actually the client receives the reply, the connection is
closed. This is happening with certain FTP clients, e.g. FileZilla:
Command:        PWD
Response:       257 "/" is current directory.
Status:         Directory listing successful
Command:        quit
Error:          Disconnected from server 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to