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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 } | 1150 } |
1151 | 1151 |
1152 { // Limit the scope of the bundler. | 1152 { // Limit the scope of the bundler. |
1153 // Set |include_ack| to false in bundler; ack inclusion happens elsewhere. | 1153 // Set |include_ack| to false in bundler; ack inclusion happens elsewhere. |
1154 ScopedPacketBundler bundler(this, NO_ACK); | 1154 ScopedPacketBundler bundler(this, NO_ACK); |
1155 visitor_->OnCanWrite(); | 1155 visitor_->OnCanWrite(); |
1156 } | 1156 } |
1157 | 1157 |
1158 // After the visitor writes, it may have caused the socket to become write | 1158 // After the visitor writes, it may have caused the socket to become write |
1159 // blocked or the congestion manager to prohibit sending, so check again. | 1159 // blocked or the congestion manager to prohibit sending, so check again. |
1160 if (visitor_->HasPendingWrites() && !resume_writes_alarm_->IsSet() && | 1160 if (visitor_->WillingAndAbleToWrite() && |
| 1161 !resume_writes_alarm_->IsSet() && |
1161 CanWrite(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA)) { | 1162 CanWrite(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA)) { |
1162 // We're not write blocked, but some stream didn't write out all of its | 1163 // We're not write blocked, but some stream didn't write out all of its |
1163 // bytes. Register for 'immediate' resumption so we'll keep writing after | 1164 // bytes. Register for 'immediate' resumption so we'll keep writing after |
1164 // other connections and events have had a chance to use the thread. | 1165 // other connections and events have had a chance to use the thread. |
1165 resume_writes_alarm_->Set(clock_->ApproximateNow()); | 1166 resume_writes_alarm_->Set(clock_->ApproximateNow()); |
1166 } | 1167 } |
1167 } | 1168 } |
1168 | 1169 |
1169 void QuicConnection::WriteIfNotBlocked() { | 1170 void QuicConnection::WriteIfNotBlocked() { |
1170 if (!writer_->IsWriteBlocked()) { | 1171 if (!writer_->IsWriteBlocked()) { |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 // If we changed the generator's batch state, restore original batch state. | 1963 // If we changed the generator's batch state, restore original batch state. |
1963 if (!already_in_batch_mode_) { | 1964 if (!already_in_batch_mode_) { |
1964 DVLOG(1) << "Leaving Batch Mode."; | 1965 DVLOG(1) << "Leaving Batch Mode."; |
1965 connection_->packet_generator_.FinishBatchOperations(); | 1966 connection_->packet_generator_.FinishBatchOperations(); |
1966 } | 1967 } |
1967 DCHECK_EQ(already_in_batch_mode_, | 1968 DCHECK_EQ(already_in_batch_mode_, |
1968 connection_->packet_generator_.InBatchMode()); | 1969 connection_->packet_generator_.InBatchMode()); |
1969 } | 1970 } |
1970 | 1971 |
1971 } // namespace net | 1972 } // namespace net |
OLD | NEW |