diff options
author | Evan Chu <evanchu@broadcom.com> | 2012-09-06 08:19:00 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-09-06 08:19:00 -0700 |
commit | 15890a0c6fcce207e25a9f9357f194b3297fca41 (patch) | |
tree | 546b5ab0ce72852c49651028248efee10dad844b | |
parent | 343c3441c8fcbb0ecc410c12ac9dc862f0d84d9f (diff) | |
parent | 7e5bdc93fb55d2090c4b32bff811abf4c39b2e52 (diff) | |
download | packages_apps_nfc-15890a0c6fcce207e25a9f9357f194b3297fca41.zip packages_apps_nfc-15890a0c6fcce207e25a9f9357f194b3297fca41.tar.gz packages_apps_nfc-15890a0c6fcce207e25a9f9357f194b3297fca41.tar.bz2 |
am 7e5bdc93: correctly handle P2P congestion event
* commit '7e5bdc93fb55d2090c4b32bff811abf4c39b2e52':
correctly handle P2P congestion event
-rw-r--r-- | nci/jni/PeerToPeer.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/nci/jni/PeerToPeer.cpp b/nci/jni/PeerToPeer.cpp index 02aded1..fdfa30c 100644 --- a/nci/jni/PeerToPeer.cpp +++ b/nci/jni/PeerToPeer.cpp @@ -1033,17 +1033,20 @@ bool PeerToPeer::send (tJNI_HANDLE jniHandle, UINT8 *buffer, UINT16 bufferLen) return (sendViaSnep(jniHandle, buffer, bufferLen)); } - nfaStat = NFA_P2pSendData (pConn->mNfaConnHandle, bufferLen, buffer); - - while (nfaStat == NFA_STATUS_CONGESTED) + while (true) { SyncEventGuard guard (pConn->mCongEvent); - pConn->mCongEvent.wait (); + nfaStat = NFA_P2pSendData (pConn->mNfaConnHandle, bufferLen, buffer); + if (nfaStat == NFA_STATUS_CONGESTED) + pConn->mCongEvent.wait (); //wait for NFA_P2P_CONGEST_EVT + else + break; - if (pConn->mNfaConnHandle == NFA_HANDLE_INVALID) + if (pConn->mNfaConnHandle == NFA_HANDLE_INVALID) //peer already disconnected + { + ALOGD_IF ((appl_trace_level>=BT_TRACE_LEVEL_DEBUG), "%s: peer disconnected", fn); return (false); - - nfaStat = NFA_P2pSendData (pConn->mNfaConnHandle, bufferLen, buffer); + } } if (nfaStat == NFA_STATUS_OK) @@ -1629,9 +1632,11 @@ void PeerToPeer::nfaServerCallback (tNFA_P2P_EVT p2pEvent, tNFA_P2P_EVT_DATA* ev { ALOGD ("%s: NFA_P2P_CONGEST_EVT; nfa handle: 0x%04x congested: %u", fn, eventData->congest.handle, eventData->congest.is_congested); - - SyncEventGuard guard (pConn->mCongEvent); - pConn->mCongEvent.notifyOne(); + if (eventData->congest.is_congested == FALSE) + { + SyncEventGuard guard (pConn->mCongEvent); + pConn->mCongEvent.notifyOne(); + } } break; |