OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 LOG(LS_ERROR) << "Binding error response:" | 80 LOG(LS_ERROR) << "Binding error response:" |
81 << " class=" << attr->eclass() | 81 << " class=" << attr->eclass() |
82 << " number=" << attr->number() << " reason='" | 82 << " number=" << attr->number() << " reason='" |
83 << attr->reason() << "'"; | 83 << attr->reason() << "'"; |
84 } | 84 } |
85 | 85 |
86 port_->OnStunBindingOrResolveRequestFailed(server_addr_); | 86 port_->OnStunBindingOrResolveRequestFailed(server_addr_); |
87 | 87 |
88 int64_t now = rtc::Time64(); | 88 int64_t now = rtc::Time64(); |
89 if (WithinLifetime(now) && | 89 if (WithinLifetime(now) && |
90 rtc::TimeDiff64(now, start_time_) < RETRY_TIMEOUT) { | 90 rtc::TimeDiff(now, start_time_) < RETRY_TIMEOUT) { |
91 port_->requests_.SendDelayed( | 91 port_->requests_.SendDelayed( |
92 new StunBindingRequest(port_, server_addr_, start_time_, lifetime_), | 92 new StunBindingRequest(port_, server_addr_, start_time_, lifetime_), |
93 port_->stun_keepalive_delay()); | 93 port_->stun_keepalive_delay()); |
94 } | 94 } |
95 } | 95 } |
96 virtual void OnTimeout() override { | 96 virtual void OnTimeout() override { |
97 LOG(LS_ERROR) << "Binding request timed out from " | 97 LOG(LS_ERROR) << "Binding request timed out from " |
98 << port_->GetLocalAddress().ToSensitiveString() << " (" | 98 << port_->GetLocalAddress().ToSensitiveString() << " (" |
99 << port_->Network()->name() << ")"; | 99 << port_->Network()->name() << ")"; |
100 | 100 |
101 port_->OnStunBindingOrResolveRequestFailed(server_addr_); | 101 port_->OnStunBindingOrResolveRequestFailed(server_addr_); |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 // Returns true if |now| is within the lifetime of the request (a negative | 105 // Returns true if |now| is within the lifetime of the request (a negative |
106 // lifetime means infinite). | 106 // lifetime means infinite). |
107 bool WithinLifetime(int64_t now) const { | 107 bool WithinLifetime(int64_t now) const { |
108 return lifetime_ < 0 || rtc::TimeDiff64(now, start_time_) <= lifetime_; | 108 return lifetime_ < 0 || rtc::TimeDiff(now, start_time_) <= lifetime_; |
109 } | 109 } |
110 UDPPort* port_; | 110 UDPPort* port_; |
111 const rtc::SocketAddress server_addr_; | 111 const rtc::SocketAddress server_addr_; |
112 | 112 |
113 int64_t start_time_; | 113 int64_t start_time_; |
114 // The time duration for which this request will be rescheduled. | 114 // The time duration for which this request will be rescheduled. |
115 int lifetime_; | 115 int lifetime_; |
116 }; | 116 }; |
117 | 117 |
118 UDPPort::AddressResolver::AddressResolver( | 118 UDPPort::AddressResolver::AddressResolver( |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 const std::vector<Candidate>& existing_candidates = Candidates(); | 519 const std::vector<Candidate>& existing_candidates = Candidates(); |
520 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); | 520 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); |
521 for (; it != existing_candidates.end(); ++it) { | 521 for (; it != existing_candidates.end(); ++it) { |
522 if (it->address() == addr) | 522 if (it->address() == addr) |
523 return true; | 523 return true; |
524 } | 524 } |
525 return false; | 525 return false; |
526 } | 526 } |
527 | 527 |
528 } // namespace cricket | 528 } // namespace cricket |
OLD | NEW |