Revert "remove stun origin support"

This reverts commit ba29ce320fe1f9ac69b0ff8eb50fbe402c2912a6.

Reason for revert: Breaks downstream projects

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}

TBR=deadbeef@webrtc.org,hta@webrtc.org,philipp.hancke@googlemail.com,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5f3a7a15c7da8e752569683bfeac91f2160a4f55
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:12132
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235241
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35209}
This commit is contained in:
Artem Titov
2021-10-14 15:02:43 +00:00
committed by WebRTC LUCI CQ
parent 8dbdf5e3bf
commit 41205b3c4d
19 changed files with 188 additions and 121 deletions

View File

@ -59,6 +59,7 @@ void StunRequestManager::Send(StunRequest* request) {
void StunRequestManager::SendDelayed(StunRequest* request, int delay) {
request->set_manager(this);
RTC_DCHECK(requests_.find(request->id()) == requests_.end());
request->set_origin(origin_);
request->Construct();
requests_[request->id()] = request;
if (delay > 0) {
@ -212,6 +213,10 @@ StunRequest::~StunRequest() {
void StunRequest::Construct() {
if (msg_->type() == 0) {
if (!origin_.empty()) {
msg_->AddAttribute(
std::make_unique<StunByteStringAttribute>(STUN_ATTR_ORIGIN, origin_));
}
Prepare(msg_);
RTC_DCHECK(msg_->type() != 0);
}