From ftpserver-commits-return-225-apmail-incubator-ftpserver-commits-archive=incubator.apache.org@incubator.apache.org Fri Oct 26 12:16:37 2007 Return-Path: Delivered-To: apmail-incubator-ftpserver-commits-archive@www.apache.org Received: (qmail 92673 invoked from network); 26 Oct 2007 12:16:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 12:16:37 -0000 Received: (qmail 81363 invoked by uid 500); 26 Oct 2007 12:16:20 -0000 Delivered-To: apmail-incubator-ftpserver-commits-archive@incubator.apache.org Received: (qmail 81348 invoked by uid 500); 26 Oct 2007 12:16:19 -0000 Mailing-List: contact ftpserver-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ftpserver-dev@incubator.apache.org Delivered-To: mailing list ftpserver-commits@incubator.apache.org Received: (qmail 81316 invoked by uid 99); 26 Oct 2007 12:16:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 05:16:19 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 12:16:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 52AA41A9832; Fri, 26 Oct 2007 05:16:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r588620 - /incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java Date: Fri, 26 Oct 2007 12:16:11 -0000 To: ftpserver-commits@incubator.apache.org From: ngn@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071026121611.52AA41A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ngn Date: Fri Oct 26 05:16:10 2007 New Revision: 588620 URL: http://svn.apache.org/viewvc?rev=588620&view=rev Log: Fix for closing connections before a reply has been sent (FTPSERVER-112). Patch by Rico Neubauer. Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java?rev=588620&r1=588619&r2=588620&view=diff ============================================================================== --- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java (original) +++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/mina/FtpResponseEncoder.java Fri Oct 26 05:16:10 2007 @@ -22,9 +22,11 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import org.apache.ftpserver.ftplet.FtpException; import org.apache.ftpserver.ftplet.FtpReply; import org.apache.mina.common.ByteBuffer; import org.apache.mina.common.IoSession; +import org.apache.mina.common.WriteFuture; import org.apache.mina.filter.codec.ProtocolEncoderAdapter; import org.apache.mina.filter.codec.ProtocolEncoderOutput; import org.apache.mina.filter.codec.demux.MessageEncoder; @@ -47,5 +49,12 @@ buf.flip(); out.write(buf); + + // 2007-10-26 - flushing the response, it is important to receive replies like 421 - service unavailable, see https://issues.apache.org/jira/browse/FTPSERVER-112 + WriteFuture future = out.flush(); + future.join(5000); + if (!future.isWritten()) { + throw new FtpException("The response could not be sent for 5 seconds"); + } } }