summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2011-07-26 20:53:39 -0500
committerMartijn Coenen <maco@google.com>2011-07-27 09:25:24 -0500
commit54b847c7f7a5bc2e36ebe877ce832cdfefabc733 (patch)
tree74e12a015455daacc9ee93d1df34d87b6aaaf9fc /src
parent379262748505107b88ec92675529063789e44da6 (diff)
downloadexternal_libnfc-nxp-54b847c7f7a5bc2e36ebe877ce832cdfefabc733.zip
external_libnfc-nxp-54b847c7f7a5bc2e36ebe877ce832cdfefabc733.tar.gz
external_libnfc-nxp-54b847c7f7a5bc2e36ebe877ce832cdfefabc733.tar.bz2
Don't wait for timeout to send SYMM PDU's.
The LLCP stack was holding onto the "I'm allowed to send" token for the full link time-out, even if there was nothing to send. This caused very bad round-trip delays. This fix just gives the token back immediately if there's nothing to send. Change-Id: Ib7bf87bd5fada2b682d28c9502b5ef010cd39815
Diffstat (limited to 'src')
-rw-r--r--src/phFriNfc_Llcp.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/phFriNfc_Llcp.c b/src/phFriNfc_Llcp.c
index 8f2987f..d6eb93e 100644
--- a/src/phFriNfc_Llcp.c
+++ b/src/phFriNfc_Llcp.c
@@ -196,24 +196,11 @@ static NFCSTATUS phFriNfc_Llcp_InternalDeactivate( phFriNfc_Llcp_t *Llcp )
static NFCSTATUS phFriNfc_Llcp_SendSymm( phFriNfc_Llcp_t *Llcp )
{
phFriNfc_Llcp_sPacketHeader_t sHeader;
- bool_t bPendingFlag;
- /* Check for pending messages to send */
- bPendingFlag = phFriNfc_Llcp_HandlePendingSend(Llcp);
-
- if (bPendingFlag == FALSE)
- {
- /* No send pending, send a SYMM instead */
- sHeader.dsap = PHFRINFC_LLCP_SAP_LINK;
- sHeader.ssap = PHFRINFC_LLCP_SAP_LINK;
- sHeader.ptype = PHFRINFC_LLCP_PTYPE_SYMM;
- return phFriNfc_Llcp_InternalSend(Llcp, &sHeader, NULL, NULL);
- }
- else
- {
- /* A pending send has been sent, there is no need to send SYMM */
- return NFCSTATUS_SUCCESS;
- }
+ sHeader.dsap = PHFRINFC_LLCP_SAP_LINK;
+ sHeader.ssap = PHFRINFC_LLCP_SAP_LINK;
+ sHeader.ptype = PHFRINFC_LLCP_PTYPE_SYMM;
+ return phFriNfc_Llcp_InternalSend(Llcp, &sHeader, NULL, NULL);
}
@@ -915,6 +902,11 @@ static bool_t phFriNfc_Llcp_HandlePendingSend ( phFriNfc_Llcp_t *Llcp )
phFriNfc_Llcp_InternalDeactivate(Llcp);
}
return_value = TRUE;
+ } else if (Llcp->pfSendCB == NULL) {
+ // Nothing to send, send SYMM instead to allow peer to send something
+ // if it wants.
+ phFriNfc_Llcp_SendSymm(Llcp);
+ return_value = TRUE;
}
clean_and_return: