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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 962 |
963 void QuicConnection::SendRstStream(QuicStreamId id, | 963 void QuicConnection::SendRstStream(QuicStreamId id, |
964 QuicRstStreamErrorCode error, | 964 QuicRstStreamErrorCode error, |
965 QuicStreamOffset bytes_written) { | 965 QuicStreamOffset bytes_written) { |
966 // Opportunistically bundle an ack with this outgoing packet. | 966 // Opportunistically bundle an ack with this outgoing packet. |
967 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); | 967 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
968 packet_generator_.AddControlFrame( | 968 packet_generator_.AddControlFrame( |
969 QuicFrame(new QuicRstStreamFrame(id, error, bytes_written))); | 969 QuicFrame(new QuicRstStreamFrame(id, error, bytes_written))); |
970 } | 970 } |
971 | 971 |
| 972 void QuicConnection::SendWindowUpdate(QuicStreamId id, |
| 973 QuicStreamOffset byte_offset) { |
| 974 // Opportunistically bundle an ack with this outgoing packet. |
| 975 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
| 976 packet_generator_.AddControlFrame( |
| 977 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); |
| 978 } |
| 979 |
| 980 void QuicConnection::SendBlocked(QuicStreamId id) { |
| 981 // Opportunistically bundle an ack with this outgoing packet. |
| 982 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
| 983 packet_generator_.AddControlFrame(QuicFrame(new QuicBlockedFrame(id))); |
| 984 } |
| 985 |
972 const QuicConnectionStats& QuicConnection::GetStats() { | 986 const QuicConnectionStats& QuicConnection::GetStats() { |
973 // Update rtt and estimated bandwidth. | 987 // Update rtt and estimated bandwidth. |
974 stats_.rtt = sent_packet_manager_.SmoothedRtt().ToMicroseconds(); | 988 stats_.rtt = sent_packet_manager_.SmoothedRtt().ToMicroseconds(); |
975 stats_.estimated_bandwidth = | 989 stats_.estimated_bandwidth = |
976 sent_packet_manager_.BandwidthEstimate().ToBytesPerSecond(); | 990 sent_packet_manager_.BandwidthEstimate().ToBytesPerSecond(); |
977 return stats_; | 991 return stats_; |
978 } | 992 } |
979 | 993 |
980 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, | 994 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
981 const IPEndPoint& peer_address, | 995 const IPEndPoint& peer_address, |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 // If we changed the generator's batch state, restore original batch state. | 1796 // If we changed the generator's batch state, restore original batch state. |
1783 if (!already_in_batch_mode_) { | 1797 if (!already_in_batch_mode_) { |
1784 DVLOG(1) << "Leaving Batch Mode."; | 1798 DVLOG(1) << "Leaving Batch Mode."; |
1785 connection_->packet_generator_.FinishBatchOperations(); | 1799 connection_->packet_generator_.FinishBatchOperations(); |
1786 } | 1800 } |
1787 DCHECK_EQ(already_in_batch_mode_, | 1801 DCHECK_EQ(already_in_batch_mode_, |
1788 connection_->packet_generator_.InBatchMode()); | 1802 connection_->packet_generator_.InBatchMode()); |
1789 } | 1803 } |
1790 | 1804 |
1791 } // namespace net | 1805 } // namespace net |
OLD | NEW |