| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 bool all_bytes_written = visitor_->OnCanWrite(); | 564 bool all_bytes_written = visitor_->OnCanWrite(); |
| 565 // If the latest write caused a socket-level blockage, return false: we will | 565 // If the latest write caused a socket-level blockage, return false: we will |
| 566 // be rescheduled by the kernel. | 566 // be rescheduled by the kernel. |
| 567 if (write_blocked_) { | 567 if (write_blocked_) { |
| 568 return false; | 568 return false; |
| 569 } | 569 } |
| 570 if (!all_bytes_written && !helper_->IsSendAlarmSet()) { | 570 if (!all_bytes_written && !helper_->IsSendAlarmSet()) { |
| 571 // We're not write blocked, but some stream didn't write out all of its | 571 // We're not write blocked, but some stream didn't write out all of its |
| 572 // bytes. Register for 'immediate' resumption so we'll keep writing after | 572 // bytes. Register for 'immediate' resumption so we'll keep writing after |
| 573 // other quic connections have had a chance to use the socket. | 573 // other quic connections have had a chance to use the socket. |
| 574 helper_->SetSendAlarm(QuicTime::Delta()); | 574 helper_->SetSendAlarm(QuicTime::Delta::Zero()); |
| 575 } | 575 } |
| 576 } | 576 } |
| 577 | 577 |
| 578 return !write_blocked_; | 578 return !write_blocked_; |
| 579 } | 579 } |
| 580 | 580 |
| 581 bool QuicConnection::WriteData() { | 581 bool QuicConnection::WriteData() { |
| 582 DCHECK_EQ(false, write_blocked_); | 582 DCHECK_EQ(false, write_blocked_); |
| 583 // Serialize the ack and congestion frames before draining the pending queue. | 583 // Serialize the ack and congestion frames before draining the pending queue. |
| 584 if (should_send_ack_) { | 584 if (should_send_ack_) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 << " delta:" << delta.ToMicroseconds(); | 915 << " delta:" << delta.ToMicroseconds(); |
| 916 if (delta >= timeout_) { | 916 if (delta >= timeout_) { |
| 917 SendConnectionClose(QUIC_CONNECTION_TIMED_OUT); | 917 SendConnectionClose(QUIC_CONNECTION_TIMED_OUT); |
| 918 return true; | 918 return true; |
| 919 } | 919 } |
| 920 helper_->SetTimeoutAlarm(timeout_.Subtract(delta)); | 920 helper_->SetTimeoutAlarm(timeout_.Subtract(delta)); |
| 921 return false; | 921 return false; |
| 922 } | 922 } |
| 923 | 923 |
| 924 } // namespace net | 924 } // namespace net |
| OLD | NEW |