diff options
author | Jakub Adam <jakub.adam@ktknet.cz> | 2015-09-02 16:32:05 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-09-02 16:33:22 +0100 |
commit | ab4ced5a46a7edba7cd49c0495bc41cd8fff7cc2 (patch) | |
tree | f68c5996d6a4a7bdc3ee4e2631d56f52788e9f2b /stun | |
parent | abdab053af41068406caf95e80a64c512fd3db90 (diff) | |
download | libnice-ab4ced5a46a7edba7cd49c0495bc41cd8fff7cc2.tar.gz |
ms-turn: don't wait for a reply to STUN_SEND request
As per [MS-TURN] Section 2.2.1, TURN message type 0x0104 "Send request
response" isn't supported and the TURN server MUST NOT send them. Thus,
libnice should not remember Send requests in agent->sent_ids because
without replies coming, the number of allowed pending transaction gets
quickly exhausted, causing our data packets to be dropped until a
request timeout frees some space in the queue.
This behavior resulted in choppy reception of our audio on a Lync client
when connected via Lync Edge (TURN) Server.
Maniphest Tasks: T126
Reviewers: pwithnall
Projects: #libnice
Reviewed By: pwithnall
Subscribers: pwithnall
Differential Revision: https://phabricator.freedesktop.org/D223
Diffstat (limited to 'stun')
-rw-r--r-- | stun/stunagent.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/stun/stunagent.c b/stun/stunagent.c index 2abcc29..bd243cb 100644 --- a/stun/stunagent.c +++ b/stun/stunagent.c @@ -513,8 +513,20 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg, uint32_t fpr; int saved_id_idx = 0; uint8_t md5[16]; + bool remember_transaction; - if (stun_message_get_class (msg) == STUN_REQUEST) { + remember_transaction = (stun_message_get_class (msg) == STUN_REQUEST); + + if (agent->compatibility == STUN_COMPATIBILITY_OC2007 && + stun_message_get_method (msg) == STUN_SEND) { + /* As per [MS-TURN] Section 2.2.1, the TURN server doesn't send responses to + * STUN_SEND requests, so don't bother waiting for them. More details at + * https://msdn.microsoft.com/en-us/library/dd946797%28v=office.12%29.aspx. + */ + remember_transaction = FALSE; + } + + if (remember_transaction) { for (saved_id_idx = 0; saved_id_idx < STUN_AGENT_MAX_SAVED_IDS; saved_id_idx++) { if (agent->sent_ids[saved_id_idx].valid == FALSE) { break; @@ -620,7 +632,7 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg, } - if (stun_message_get_class (msg) == STUN_REQUEST) { + if (remember_transaction) { stun_message_id (msg, agent->sent_ids[saved_id_idx].id); agent->sent_ids[saved_id_idx].method = stun_message_get_method (msg); agent->sent_ids[saved_id_idx].key = (uint8_t *) key; |