void QueueWriteData(UnixSocketRawData* aData) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsShutdownOnIOThread()); mOutgoingQ.AppendElement(aData); OnFileCanWriteWithoutBlocking(mFd); }
void BluetoothDaemonConnectionIO::OnSocketCanSendWithoutBlocking() { MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop()); MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); MOZ_ASSERT(!IsShutdownOnIOThread()); if (NS_WARN_IF(NS_FAILED(SendPendingData(GetFd())))) { RemoveWatchers(WRITE_WATCHER); } }
void ConnectionOrientedSocketIO::OnSocketCanSendWithoutBlocking() { MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop()); MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); // see bug 990984 MOZ_ASSERT(!IsShutdownOnIOThread()); nsresult rv = SendPendingData(GetFd()); if (NS_FAILED(rv)) { return; } if (HasPendingData()) { AddWatchers(WRITE_WATCHER, false); } }
void BluetoothDaemonConnectionIO::OnSocketCanReceiveWithoutBlocking() { MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop()); MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); MOZ_ASSERT(!IsShutdownOnIOThread()); ssize_t res = ReceiveData(GetFd()); if (res < 0) { /* I/O error */ RemoveWatchers(READ_WATCHER|WRITE_WATCHER); } else if (!res) { /* EOF or peer shutdown */ RemoveWatchers(READ_WATCHER); } }