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 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 // We should serialize handshake packets immediately to ensure that they | 1283 // We should serialize handshake packets immediately to ensure that they |
1284 // end up sent at the right encryption level. | 1284 // end up sent at the right encryption level. |
1285 if (handshake == IS_HANDSHAKE) { | 1285 if (handshake == IS_HANDSHAKE) { |
1286 return true; | 1286 return true; |
1287 } | 1287 } |
1288 | 1288 |
1289 return CanWrite(retransmittable); | 1289 return CanWrite(retransmittable); |
1290 } | 1290 } |
1291 | 1291 |
1292 bool QuicConnection::CanWrite(HasRetransmittableData retransmittable) { | 1292 bool QuicConnection::CanWrite(HasRetransmittableData retransmittable) { |
| 1293 if (!connected_) { |
| 1294 return false; |
| 1295 } |
| 1296 |
1293 if (writer_->IsWriteBlocked()) { | 1297 if (writer_->IsWriteBlocked()) { |
1294 visitor_->OnWriteBlocked(); | 1298 visitor_->OnWriteBlocked(); |
1295 return false; | 1299 return false; |
1296 } | 1300 } |
1297 | 1301 |
1298 QuicTime now = clock_->Now(); | 1302 QuicTime now = clock_->Now(); |
1299 QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend( | 1303 QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend( |
1300 now, retransmittable); | 1304 now, retransmittable); |
1301 if (delay.IsInfinite()) { | 1305 if (delay.IsInfinite()) { |
1302 send_alarm_->Cancel(); | 1306 send_alarm_->Cancel(); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 } | 2010 } |
2007 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { | 2011 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { |
2008 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { | 2012 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { |
2009 return true; | 2013 return true; |
2010 } | 2014 } |
2011 } | 2015 } |
2012 return false; | 2016 return false; |
2013 } | 2017 } |
2014 | 2018 |
2015 } // namespace net | 2019 } // namespace net |
OLD | NEW |