Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: webrtc/libjingle/xmpp/pingtask.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/libjingle/xmpp/pingtask.h ('k') | webrtc/libjingle/xmpp/pingtask_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "webrtc/libjingle/xmpp/pingtask.h" 11 #include "webrtc/libjingle/xmpp/pingtask.h"
12 12
13 #include "webrtc/libjingle/xmpp/constants.h" 13 #include "webrtc/libjingle/xmpp/constants.h"
14 #include "webrtc/base/logging.h" 14 #include "webrtc/base/logging.h"
15 #include "webrtc/base/scoped_ptr.h" 15 #include "webrtc/base/scoped_ptr.h"
16 16
17 namespace buzz { 17 namespace buzz {
18 18
19 PingTask::PingTask(buzz::XmppTaskParentInterface* parent, 19 PingTask::PingTask(buzz::XmppTaskParentInterface* parent,
20 rtc::MessageQueue* message_queue, 20 rtc::MessageQueue* message_queue,
21 uint32 ping_period_millis, 21 uint32_t ping_period_millis,
22 uint32 ping_timeout_millis) 22 uint32_t ping_timeout_millis)
23 : buzz::XmppTask(parent, buzz::XmppEngine::HL_SINGLE), 23 : buzz::XmppTask(parent, buzz::XmppEngine::HL_SINGLE),
24 message_queue_(message_queue), 24 message_queue_(message_queue),
25 ping_period_millis_(ping_period_millis), 25 ping_period_millis_(ping_period_millis),
26 ping_timeout_millis_(ping_timeout_millis), 26 ping_timeout_millis_(ping_timeout_millis),
27 next_ping_time_(0), 27 next_ping_time_(0),
28 ping_response_deadline_(0) { 28 ping_response_deadline_(0) {
29 ASSERT(ping_period_millis >= ping_timeout_millis); 29 ASSERT(ping_period_millis >= ping_timeout_millis);
30 } 30 }
31 31
32 bool PingTask::HandleStanza(const buzz::XmlElement* stanza) { 32 bool PingTask::HandleStanza(const buzz::XmlElement* stanza) {
(...skipping 16 matching lines...) Expand all
49 if (ping_period_millis_ < ping_timeout_millis_) { 49 if (ping_period_millis_ < ping_timeout_millis_) {
50 LOG(LS_ERROR) << "ping_period_millis should be >= ping_timeout_millis"; 50 LOG(LS_ERROR) << "ping_period_millis should be >= ping_timeout_millis";
51 return STATE_ERROR; 51 return STATE_ERROR;
52 } 52 }
53 const buzz::XmlElement* stanza = NextStanza(); 53 const buzz::XmlElement* stanza = NextStanza();
54 if (stanza != NULL) { 54 if (stanza != NULL) {
55 // Received a ping response of some sort (don't care what it is). 55 // Received a ping response of some sort (don't care what it is).
56 ping_response_deadline_ = 0; 56 ping_response_deadline_ = 0;
57 } 57 }
58 58
59 uint32 now = rtc::Time(); 59 uint32_t now = rtc::Time();
60 60
61 // If the ping timed out, signal. 61 // If the ping timed out, signal.
62 if (ping_response_deadline_ != 0 && now >= ping_response_deadline_) { 62 if (ping_response_deadline_ != 0 && now >= ping_response_deadline_) {
63 SignalTimeout(); 63 SignalTimeout();
64 return STATE_ERROR; 64 return STATE_ERROR;
65 } 65 }
66 66
67 // Send a ping if it's time. 67 // Send a ping if it's time.
68 if (now >= next_ping_time_) { 68 if (now >= next_ping_time_) {
69 rtc::scoped_ptr<buzz::XmlElement> stanza( 69 rtc::scoped_ptr<buzz::XmlElement> stanza(
(...skipping 13 matching lines...) Expand all
83 return STATE_BLOCKED; 83 return STATE_BLOCKED;
84 } 84 }
85 85
86 void PingTask::OnMessage(rtc::Message* msg) { 86 void PingTask::OnMessage(rtc::Message* msg) {
87 // Get the task manager to run this task so we can send a ping or signal or 87 // Get the task manager to run this task so we can send a ping or signal or
88 // process a ping response. 88 // process a ping response.
89 Wake(); 89 Wake();
90 } 90 }
91 91
92 } // namespace buzz 92 } // namespace buzz
OLDNEW
« no previous file with comments | « webrtc/libjingle/xmpp/pingtask.h ('k') | webrtc/libjingle/xmpp/pingtask_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698