зеркало из https://github.com/mozilla/gecko-dev.git
Add the ability to open a file based socket. (Part of the nsITransport) code....
This commit is contained in:
Родитель
34b1e85458
Коммит
435e274507
|
@ -251,6 +251,14 @@ struct nsINetService : public nsISupports
|
|||
*/
|
||||
|
||||
NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName) = 0;
|
||||
|
||||
/**
|
||||
* Protocol connection pools should use this call into the service manager to produce
|
||||
* a transport interface to a file based socket. You need to pass in the name of the file
|
||||
* you want to associate with the socket transport
|
||||
*/
|
||||
|
||||
NS_IMETHOD CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName) = 0;
|
||||
|
||||
NS_IMETHOD AreThereActiveConnections(void) = 0;
|
||||
};
|
||||
|
|
|
@ -1056,6 +1056,24 @@ NS_IMETHODIMP nsNetlibService::CreateSocketTransport(nsITransport **aTransport,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNetlibService::CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName)
|
||||
{
|
||||
NS_PRECONDITION(aFileName, "You need to specify the file name of the file you wish to create a socket for");
|
||||
|
||||
nsSocketTransport *pNSSocketTransport = NULL;
|
||||
|
||||
NS_DEFINE_IID(kITransportIID, NS_ITRANSPORT_IID);
|
||||
|
||||
pNSSocketTransport = new nsSocketTransport(aFileName);
|
||||
if (pNSSocketTransport->QueryInterface(kITransportIID, (void**)aTransport) != NS_OK) {
|
||||
// then we're trying get a interface other than nsISupports and
|
||||
// nsITransport
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNetlibService::AreThereActiveConnections()
|
||||
|
|
|
@ -100,6 +100,8 @@ public:
|
|||
|
||||
NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName);
|
||||
|
||||
NS_IMETHOD CreateFileSocketTransport(nsITransport **aTransport, const char * aFileName);
|
||||
|
||||
protected:
|
||||
virtual ~nsNetlibService();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче