| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 | 2094 |
| 2095 timeout_alarm_->Cancel(); | 2095 timeout_alarm_->Cancel(); |
| 2096 timeout_alarm_->Set(deadline); | 2096 timeout_alarm_->Set(deadline); |
| 2097 } | 2097 } |
| 2098 | 2098 |
| 2099 void QuicConnection::SetPingAlarm() { | 2099 void QuicConnection::SetPingAlarm() { |
| 2100 if (perspective_ == Perspective::IS_SERVER) { | 2100 if (perspective_ == Perspective::IS_SERVER) { |
| 2101 // Only clients send pings. | 2101 // Only clients send pings. |
| 2102 return; | 2102 return; |
| 2103 } | 2103 } |
| 2104 if (!visitor_->HasOpenDataStreams()) { | 2104 if (!visitor_->HasOpenDynamicStreams()) { |
| 2105 ping_alarm_->Cancel(); | 2105 ping_alarm_->Cancel(); |
| 2106 // Don't send a ping unless there are open streams. | 2106 // Don't send a ping unless there are open streams. |
| 2107 return; | 2107 return; |
| 2108 } | 2108 } |
| 2109 QuicTime::Delta ping_timeout = QuicTime::Delta::FromSeconds(kPingTimeoutSecs); | 2109 QuicTime::Delta ping_timeout = QuicTime::Delta::FromSeconds(kPingTimeoutSecs); |
| 2110 ping_alarm_->Update(clock_->ApproximateNow().Add(ping_timeout), | 2110 ping_alarm_->Update(clock_->ApproximateNow().Add(ping_timeout), |
| 2111 QuicTime::Delta::FromSeconds(1)); | 2111 QuicTime::Delta::FromSeconds(1)); |
| 2112 } | 2112 } |
| 2113 | 2113 |
| 2114 QuicConnection::ScopedPacketBundler::ScopedPacketBundler( | 2114 QuicConnection::ScopedPacketBundler::ScopedPacketBundler( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 } | 2169 } |
| 2170 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2170 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
| 2171 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2171 if (frame.type == CONNECTION_CLOSE_FRAME) { |
| 2172 return true; | 2172 return true; |
| 2173 } | 2173 } |
| 2174 } | 2174 } |
| 2175 return false; | 2175 return false; |
| 2176 } | 2176 } |
| 2177 | 2177 |
| 2178 } // namespace net | 2178 } // namespace net |
| OLD | NEW |