зеркало из https://github.com/mozilla/gecko-dev.git
Bug 849078 - Change SetNonblockFlags to SetSocketFlags; r=echou
--HG-- extra : rebase_source : 495444e95cb6fef3cdae4606879b2f2fba812c24
This commit is contained in:
Родитель
e52a469f5e
Коммит
7eef9798c9
|
@ -127,11 +127,11 @@ public:
|
|||
void Accept();
|
||||
|
||||
/**
|
||||
* Set up nonblocking flags on whatever our current file descriptor is.
|
||||
* Set up flags on whatever our current file descriptor is.
|
||||
*
|
||||
* @return true if successful, false otherwise
|
||||
*/
|
||||
bool SetNonblockFlags();
|
||||
bool SetSocketFlags();
|
||||
|
||||
void GetSocketAddr(nsAString& aAddrStr)
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ UnixSocketImpl::Accept()
|
|||
return;
|
||||
}
|
||||
|
||||
if (!SetNonblockFlags()) {
|
||||
if (!SetSocketFlags()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -508,6 +508,10 @@ UnixSocketImpl::Connect()
|
|||
return;
|
||||
}
|
||||
|
||||
if (!SetSocketFlags()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mConnector->SetUp(mFd)) {
|
||||
NS_WARNING("Could not set up socket!");
|
||||
return;
|
||||
|
@ -521,7 +525,7 @@ UnixSocketImpl::Connect()
|
|||
}
|
||||
|
||||
bool
|
||||
UnixSocketImpl::SetNonblockFlags()
|
||||
UnixSocketImpl::SetSocketFlags()
|
||||
{
|
||||
// Set socket addr to be reused even if kernel is still waiting to close
|
||||
int n = 1;
|
||||
|
@ -671,6 +675,10 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd)
|
|||
mWriteWatcher.StopWatchingFileDescriptor();
|
||||
|
||||
mFd.reset(client_fd);
|
||||
if (!SetSocketFlags()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIOLoop = nullptr;
|
||||
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
|
|
Загрузка…
Ссылка в новой задаче