mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
23039. r=rpotts. FTP wasn't closing the data connection after data transfer. This was causing it to hang, waiting for the command channel to unblock.
This commit is contained in:
parent
4c6aed1d16
commit
ec7d6b07da
@ -50,6 +50,7 @@ XPIDLSRCS = \
|
||||
nsIFileSystem.idl \
|
||||
nsIUnicharStreamLoader.idl \
|
||||
nsINetPrompt.idl \
|
||||
nsISocketTransport.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
@ -51,6 +51,7 @@ XPIDLSRCS = \
|
||||
.\nsIFileSystem.idl \
|
||||
.\nsIUnicharStreamLoader.idl \
|
||||
.\nsINetPrompt.idl \
|
||||
.\nsISocketTransport.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/rules.mak>
|
||||
|
29
netwerk/base/public/nsISocketTransport.idl
Normal file
29
netwerk/base/public/nsISocketTransport.idl
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(785CA0F0-C39E-11d3-9ED6-0010A4053FD0)]
|
||||
interface nsISocketTransport : nsISupports
|
||||
{
|
||||
attribute boolean reuseConnection;
|
||||
};
|
@ -1189,33 +1189,29 @@ void nsSocketTransport::SetSocketTimeout(PRIntervalTime aTimeInterval)
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsSocketTransport);
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsSocketTransport);
|
||||
NS_IMPL_QUERY_INTERFACE5(nsSocketTransport,
|
||||
nsIRequest, nsIChannel,
|
||||
nsIDNSListener, nsIPipeObserver,
|
||||
nsISocketTransport);
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
// nsISocketTransport implementation...
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::QueryInterface(const nsIID& aIID, void* *aInstancePtr)
|
||||
nsSocketTransport::GetReuseConnection(PRBool *_retval)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIChannel)) ||
|
||||
aIID.Equals(NS_GET_IID(nsIRequest)) ||
|
||||
aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIChannel*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIDNSListener))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIDNSListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
*_retval = !mCloseConnectionOnceDone;
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIPipeObserver))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIPipeObserver*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::SetReuseConnection(PRBool aReuse)
|
||||
{
|
||||
mCloseConnectionOnceDone = !aReuse;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include "prio.h"
|
||||
#include "prnetdb.h"
|
||||
#include "prinrval.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISocketTransport.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
@ -110,12 +110,14 @@ enum nsSocketReadWriteInfo {
|
||||
class nsSocketTransportService;
|
||||
class nsIInterfaceRequestor;
|
||||
|
||||
class nsSocketTransport : public nsIChannel,
|
||||
class nsSocketTransport : public nsISocketTransport,
|
||||
public nsIChannel,
|
||||
public nsIDNSListener,
|
||||
public nsIPipeObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISOCKETTRANSPORT
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIPIPEOBSERVER
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsFtpConnectionThread.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsISocketTransport.h"
|
||||
#include "nsIPipe.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsIStreamConverterService.h"
|
||||
@ -1526,6 +1527,11 @@ nsFtpConnectionThread::R_pasv() {
|
||||
getter_AddRefs(mDPipe)); // the data channel
|
||||
if (NS_FAILED(rv)) return FTP_ERROR;
|
||||
|
||||
nsCOMPtr<nsISocketTransport> sTrans = do_QueryInterface(mDPipe, &rv);
|
||||
if (NS_FAILED(rv)) return FTP_ERROR;
|
||||
|
||||
if (NS_FAILED(sTrans->SetReuseConnection(PR_FALSE))) return FTP_ERROR;
|
||||
|
||||
// The FTP connection thread will receive transport leve
|
||||
// AsyncOpen notifications.
|
||||
rv = mDPipe->AsyncOpen(this, nsnull);
|
||||
|
Loading…
Reference in New Issue
Block a user