This removes MessageHandler and Thread dependencies from StunRequest
and StunRequestManager. Instead the TaskQueueBase abstraction is
used for async posting and synchronous Clear() operations removed by
using a pending task safety flag.
Bug: webrtc:9702
Change-Id: I6e9ed5e1b4c446fd1f91af06e3ab36bccb5d7320
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265060
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37218}
Construction in StunRequest and derived classes now happens in
the ctor.
Bug: none
Change-Id: I803f6fd2b6d0ac1d9426304d1e1de10dec855eed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264942
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37126}
* Add ctors for providing the type and transaction id at construction.
* Update tests to use them instead of SetType+SetTransactionID
* Make sure stun message enum types are based on uint16_t
* Mark SetTransactionID as deprecated.
* Mark SetStunMagicCookie as deprecated (unused in webrtc).
* Add SetTransactionIdForTest for the one test that uses it (might not
actually need it)
* Make StunRequest::Construct() protected.
* Add a TODO to follow up on this since construction of StunRequest
goes through an unnecessarily complex 3-step process involving
other classes and a virtual method.
Bug: none
Change-Id: Ib013e58f28e7b2b4fcb3b3e1034da31dfc93e9d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264546
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37079}
This is just to reduce confusion since StunMessage and StunRequest
instances are frequently used together and message objects are often
configured from within request objects (which makes the name confusing).
Bug: none
Change-Id: I8bf5e774a5149239dd3023817614d411633bf583
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258484
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36533}
This removes the circular delete/remove pattern between the StunRequest
and StunRequestManager whereby deleting a request would call the
manager from the dtor to do a lookup+erase from the map. Instead
the operation of removing from the map, equals delete and is controlled
by the manager (owner) class.
Bug: webrtc:13892
Change-Id: I1920ac4b98636d38b851f4c2057026bfbd392584
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258660
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36532}
* Make StunRequest::manager_ a reference, inject ref at ctor time.
* Make other member variables private.
* Mark methods that are only used for testing with "ForTest"
* Add RTC_GUARDED_BY for member variables and thread checks.
* Remove/reduce 'friend'-ness between classes.
* Use std::unique_ptr for owned and passed message pointers.
* Rename `requests_` to `request_manager_` (type: StunRequestManager)
Bug: webrtc:13892
Change-Id: I3a5d511b3c2645bb6813352d39e9fefe422dd1de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258620
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36529}
This reverts commit 3b18208f13
and is the third attempt at removing stun origin support
Bug: webrtc:12132
Change-Id: Ic41a6d011fb6239907a257cc4c81ec4d2923dc4e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/236260
Reviewed-by: Taylor Brandstetter <deadbeef@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Christoffer Jansson <jansson@google.com>
Cr-Commit-Position: refs/heads/main@{#35294}
This is a reland of ba29ce320f
readding the origin to the CreateRelayPortArgs structure to not break
downstream tests yet:
https://webrtc-review.googlesource.com/c/src/+/235300/1..2
Original change's description:
> remove stun origin support
>
> Bug: webrtc:12132
> Change-Id: I0f32e6af77e0c553b0c3b0d047ff03e14c492b31
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234384
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35202}
Bug: webrtc:12132
Change-Id: Ied840b59bb7c9497e98f9b80eb0a54d30008a40f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235300
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35220}
The class already clears the thread that's used in its dtor
and consistently uses the same thread.
Bug: webrtc:11908
Change-Id: I5ea8d00c2e59bf46c5b369be5b23cf1d8e1875c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184060
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32097}
As documented in webrtc:11908 this cleanup is fairly invasive and
when a part of a frequently executed code path, can be quite costly
in terms of performance overhead. This is currently the case with
synchronous calls between threads (Thread) as well with our proxy
api classes.
With this CL, all code in WebRTC should now either be using MessageHandlerAutoCleanup
or calling MessageHandler(false) explicitly.
Next steps will be to update external code to either depend on the
AutoCleanup variant, or call MessageHandler(false).
Changing the proxy classes to use TaskQueue set of concepts instead of
MessageHandler. This avoids the perf overhead related to the cleanup
above as well as incompatibility with the thread policy checks in
Thread that some current external users of the proxies would otherwise
run into (if we were to use Thread::Send() for synchronous call).
Following this we'll move the cleanup step into the AutoCleanup class
and an RTC_DCHECK that all calls to the MessageHandler are setting
the flag to false, before eventually removing the flag and make
MessageHandler pure virtual.
Bug: webrtc:11908
Change-Id: Idf4ff9bcc8438cb8c583777e282005e0bc511c8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183442
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32049}
Since there is no plan to follow-up on this, this CL removes the
field trial and the conditional logic based on it.
Bug: webrtc:11503, webrtc:10282
Change-Id: Iaf005eba6af0e23ea50456d75c5c53f37d488f7d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173477
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31062}
This is part of a CL series merging rtc::MessageQueue into rtc::Thread.
Bug: webrtc:9883
Change-Id: I3cb857cc707d5e897759366d1478cc1ec19bce9a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165344
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30180}
We now have two downstream users of stun.h, so it appears to be
generally usable. I put this in a new dir networking/, but I'm open to
suggestions here (maybe some things in api/ should move in there).
I checked what our downstream users are actually using, and it's
cricket::ComputeStunCredentialHash
cricket::<constants>
cricket::TurnMessage
cricket::GetStunErrorResponseType
cricket::StunAttribute::CreateAddress
cricket::StunErrorCodeAttribute
cricket::StunByteStringAttribute
StunAttribute::CreateUnknownAttributes
cricket::TurnErrorType
cricket::StunMessage
I reckoned that was pretty much everything in stun.h, so I didn't
bother splitting it up. They don't use every function and constant
in there, but all _types_ of functions and constants, so for the
sake of coherence I don't think it makes sense to split it.
There's some old stuff in there like GTURN which could arguably
be split out, but it should likely go away soon anyway, so I don't
think it's worth the effort.
Steps:
1) land this
2) update downstream to point to the new header and target
3) remove p2p/base:stun_types.
Bug: webrtc:11091
Change-Id: I1f05bf06055475d25601197ec6fefb8d3b55e8e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159923
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29822}