OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 if (ping_period_millis_ < ping_timeout_millis_) { | 50 if (ping_period_millis_ < ping_timeout_millis_) { |
51 LOG(LS_ERROR) << "ping_period_millis should be >= ping_timeout_millis"; | 51 LOG(LS_ERROR) << "ping_period_millis should be >= ping_timeout_millis"; |
52 return STATE_ERROR; | 52 return STATE_ERROR; |
53 } | 53 } |
54 const buzz::XmlElement* stanza = NextStanza(); | 54 const buzz::XmlElement* stanza = NextStanza(); |
55 if (stanza != NULL) { | 55 if (stanza != NULL) { |
56 // Received a ping response of some sort (don't care what it is). | 56 // Received a ping response of some sort (don't care what it is). |
57 ping_response_deadline_ = 0; | 57 ping_response_deadline_ = 0; |
58 } | 58 } |
59 | 59 |
60 uint32_t now = rtc::Time(); | 60 int64_t now = rtc::TimeMillis(); |
61 | 61 |
62 // If the ping timed out, signal. | 62 // If the ping timed out, signal. |
63 if (ping_response_deadline_ != 0 && now >= ping_response_deadline_) { | 63 if (ping_response_deadline_ != 0 && now >= ping_response_deadline_) { |
64 SignalTimeout(); | 64 SignalTimeout(); |
65 return STATE_ERROR; | 65 return STATE_ERROR; |
66 } | 66 } |
67 | 67 |
68 // Send a ping if it's time. | 68 // Send a ping if it's time. |
69 if (now >= next_ping_time_) { | 69 if (now >= next_ping_time_) { |
70 std::unique_ptr<buzz::XmlElement> stanza( | 70 std::unique_ptr<buzz::XmlElement> stanza( |
(...skipping 13 matching lines...) Expand all Loading... |
84 return STATE_BLOCKED; | 84 return STATE_BLOCKED; |
85 } | 85 } |
86 | 86 |
87 void PingTask::OnMessage(rtc::Message* msg) { | 87 void PingTask::OnMessage(rtc::Message* msg) { |
88 // Get the task manager to run this task so we can send a ping or signal or | 88 // Get the task manager to run this task so we can send a ping or signal or |
89 // process a ping response. | 89 // process a ping response. |
90 Wake(); | 90 Wake(); |
91 } | 91 } |
92 | 92 |
93 } // namespace buzz | 93 } // namespace buzz |
OLD | NEW |