Bug 1164425: Rename |SocketBase::CloseSocket| to |SocketBase::Close|, r=kmachulis

This commit is contained in:
Thomas Zimmermann 2015-05-20 09:54:27 +02:00
parent eeac4617ca
commit 8e10928ea3
14 changed files with 56 additions and 79 deletions

View File

@ -1911,7 +1911,7 @@ BluetoothDaemonInterface::OnConnectSuccess(enum Channel aChannel)
} else if (
NS_WARN_IF(mNtfChannel->GetConnectionStatus() == SOCKET_CONNECTED)) {
/* Notification channel should not be open; let's close it. */
mNtfChannel->CloseSocket();
mNtfChannel->Close();
}
if (!mListenSocket->Listen(mNtfChannel)) {
OnConnectError(NTF_CHANNEL);
@ -1942,7 +1942,7 @@ BluetoothDaemonInterface::OnConnectError(enum Channel aChannel)
switch (aChannel) {
case NTF_CHANNEL:
// Close command channel
mCmdChannel->CloseSocket();
mCmdChannel->Close();
case CMD_CHANNEL:
// Stop daemon and close listen socket
unused << NS_WARN_IF(property_set("ctl.stop", "bluetoothd"));
@ -2120,7 +2120,7 @@ BluetoothDaemonInterface::Init(
} else if (
NS_WARN_IF(mCmdChannel->GetConnectionStatus() == SOCKET_CONNECTED)) {
// Command channel should not be open; let's close it.
mCmdChannel->CloseSocket();
mCmdChannel->Close();
}
// The listen socket's name is generated with a random postfix. This
@ -2182,7 +2182,7 @@ private:
mInterface->mProtocol->UnregisterModuleCmd(0x01, this);
} else {
// Cleanup, step 3: Close command channel
mInterface->mCmdChannel->CloseSocket();
mInterface->mCmdChannel->Close();
}
}

View File

@ -183,7 +183,7 @@ public:
void Run() override
{
MOZ_ASSERT(NS_IsMainThread());
mSocket->CloseSocket();
mSocket->Close();
}
private:
@ -282,7 +282,7 @@ BluetoothOppManager::ConnectInternal(const nsAString& aDeviceAddress)
// Stop listening because currently we only support one connection at a time.
if (mServerSocket) {
mServerSocket->CloseSocket();
mServerSocket->Close();
mServerSocket = nullptr;
}
@ -352,7 +352,7 @@ BluetoothOppManager::Listen()
* BT restarts.
*/
if (mServerSocket) {
mServerSocket->CloseSocket();
mServerSocket->Close();
mServerSocket = nullptr;
}
@ -1552,7 +1552,7 @@ void
BluetoothOppManager::Disconnect(BluetoothProfileController* aController)
{
if (mSocket) {
mSocket->CloseSocket();
mSocket->Close();
} else {
BT_WARNING("%s: No ongoing file transfer to stop", __FUNCTION__);
}

View File

@ -743,7 +743,7 @@ BluetoothSocket::SendSocketData(UnixSocketIOBuffer* aBuffer)
// |SocketBase|
void
BluetoothSocket::CloseSocket()
BluetoothSocket::Close()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(sBluetoothSocketInterface);

View File

@ -63,7 +63,7 @@ public:
// Methods for |SocketBase|
//
void CloseSocket() override;
void Close() override;
void OnConnectSuccess() override;
void OnConnectError() override;

View File

@ -720,7 +720,7 @@ BluetoothSocket::SendSocketData(UnixSocketIOBuffer* aBuffer)
// |SocketBase|
void
BluetoothSocket::CloseSocket()
BluetoothSocket::Close()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mIO) {

View File

@ -38,7 +38,7 @@ public:
int aChannel);
inline void Disconnect()
{
CloseSocket();
Close();
}
inline void GetAddress(nsAString& aDeviceAddress)
@ -102,7 +102,7 @@ public:
// Methods for |SocketBase|
//
void CloseSocket() override;
void Close() override;
void OnConnectSuccess() override;
void OnConnectError() override;

View File

@ -569,7 +569,7 @@ BluetoothDaemonConnection::SendSocketData(UnixSocketIOBuffer* aBuffer)
// |SocketBase|
void
BluetoothDaemonConnection::CloseSocket()
BluetoothDaemonConnection::Close()
{
MOZ_ASSERT(NS_IsMainThread());

View File

@ -131,7 +131,7 @@ public:
// Methods for |SocketBase|
//
void CloseSocket() override;
void Close() override;
protected:

View File

@ -314,27 +314,6 @@ ListenSocket::~ListenSocket()
MOZ_ASSERT(!mIO);
}
void
ListenSocket::Close()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mIO) {
return;
}
// From this point on, we consider mIO as being deleted. We sever
// the relationship here so any future calls to listen or connect
// will create a new implementation.
mIO->ShutdownOnMainThread();
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new SocketIOShutdownTask(mIO));
mIO = nullptr;
NotifyDisconnect();
}
bool
ListenSocket::Listen(UnixSocketConnector* aConnector,
ConnectionOrientedSocket* aCOSocket)
@ -385,9 +364,24 @@ ListenSocket::GetSocketAddr(nsAString& aAddrStr)
// |SocketBase|
void
ListenSocket::CloseSocket()
ListenSocket::Close()
{
Close();
MOZ_ASSERT(NS_IsMainThread());
if (!mIO) {
return;
}
// From this point on, we consider mIO as being deleted. We sever
// the relationship here so any future calls to listen or connect
// will create a new implementation.
mIO->ShutdownOnMainThread();
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new SocketIOShutdownTask(mIO));
mIO = nullptr;
NotifyDisconnect();
}
} // namespace ipc

View File

@ -50,12 +50,6 @@ public:
*/
bool Listen(ConnectionOrientedSocket* aCOSocket);
/**
* Queues the internal representation of socket for deletion. Can be called
* from main thread.
*/
void Close();
/**
* Get the current sockaddr for the socket
*/
@ -64,7 +58,7 @@ public:
// Methods for |SocketBase|
//
void CloseSocket() override;
void Close() override;
private:
ListenSocketIO* mIO;

View File

@ -340,7 +340,7 @@ SocketIORequestClosingRunnable::Run()
SocketBase* socketBase = io->GetSocketBase();
MOZ_ASSERT(socketBase);
socketBase->CloseSocket();
socketBase->Close();
return NS_OK;
}

View File

@ -258,7 +258,7 @@ public:
* Queues the internal representation of socket for deletion. Can be called
* from main thread.
*/
virtual void CloseSocket() = 0;
virtual void Close() = 0;
/**
* Callback for socket connect/accept success. Called after connect/accept has

View File

@ -542,29 +542,6 @@ StreamSocket::SendSocketData(const nsACString& aStr)
return true;
}
void
StreamSocket::Close()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mIO) {
return;
}
mIO->CancelDelayedConnectTask();
// From this point on, we consider mIO as being deleted.
// We sever the relationship here so any future calls to listen or connect
// will create a new implementation.
mIO->ShutdownOnMainThread();
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new SocketIOShutdownTask(mIO));
mIO = nullptr;
NotifyDisconnect();
}
void
StreamSocket::GetSocketAddr(nsAString& aAddrStr)
{
@ -640,10 +617,28 @@ StreamSocket::SendSocketData(UnixSocketIOBuffer* aBuffer)
// |SocketBase|
void
StreamSocket::CloseSocket()
StreamSocket::Close()
{
Close();
MOZ_ASSERT(NS_IsMainThread());
if (!mIO) {
return;
}
mIO->CancelDelayedConnectTask();
// From this point on, we consider mIO as being deleted.
// We sever the relationship here so any future calls to listen or connect
// will create a new implementation.
mIO->ShutdownOnMainThread();
XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new SocketIOShutdownTask(mIO));
mIO = nullptr;
NotifyDisconnect();
}
} // namespace ipc
} // namespace mozilla

View File

@ -55,12 +55,6 @@ public:
const char* aAddress,
int aDelayMs = 0);
/**
* Queues the internal representation of socket for deletion. Can be called
* from main thread.
*/
void Close();
/**
* Get the current sockaddr for the socket
*/
@ -74,7 +68,7 @@ public:
// Methods for |SocketBase|
//
void CloseSocket() override;
void Close() override;
protected:
virtual ~StreamSocket();