void BluetoothDaemonConnectionIO::ConsumeBuffer() { MOZ_ASSERT(mConsumer); mConsumer->Handle(*mPDU); }
void BluetoothDaemonConnectionIO::Send(BluetoothDaemonPDU* aPDU) { MOZ_ASSERT(mConsumer); MOZ_ASSERT(aPDU); mConsumer->StoreUserData(*aPDU); // Store user data for reply EnqueueData(aPDU); AddWatchers(WRITE_WATCHER, false); }
ssize_t BluetoothDaemonConnectionIO::ReceiveData(int aFd) { MOZ_ASSERT(aFd >= 0); ssize_t res = mPDU->Receive(aFd); if (res < 0) { /* an I/O error occured */ nsRefPtr<nsRunnable> r = new SocketIORequestClosingRunnable<BluetoothDaemonConnectionIO>(this); NS_DispatchToMainThread(r); return -1; } else if (!res) { /* EOF or peer shut down sending */ nsRefPtr<nsRunnable> r = new SocketIORequestClosingRunnable<BluetoothDaemonConnectionIO>(this); NS_DispatchToMainThread(r); return 0; } mConsumer->Handle(*mPDU); return res; }