| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A server specific QuicSession subclass. | 5 // A server specific QuicSession subclass. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_QUIC_SERVER_SESSION_H_ | 7 #ifndef NET_QUIC_QUIC_SERVER_SESSION_H_ |
| 8 #define NET_QUIC_QUIC_SERVER_SESSION_H_ | 8 #define NET_QUIC_QUIC_SERVER_SESSION_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Takes ownership of connection_packet_writer | 47 // Takes ownership of connection_packet_writer |
| 48 QuicServerSession(const QuicConfig& config, | 48 QuicServerSession(const QuicConfig& config, |
| 49 QuicConnection* connection, | 49 QuicConnection* connection, |
| 50 QuicPerConnectionPacketWriter* connection_packet_writer, | 50 QuicPerConnectionPacketWriter* connection_packet_writer, |
| 51 QuicServerSessionVisitor* visitor); | 51 QuicServerSessionVisitor* visitor); |
| 52 | 52 |
| 53 // Override the base class to notify the owner of the connection close. | 53 // Override the base class to notify the owner of the connection close. |
| 54 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; | 54 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 55 virtual void OnWriteBlocked() OVERRIDE; | 55 virtual void OnWriteBlocked() OVERRIDE; |
| 56 | 56 |
| 57 // Sends a server config update to the client, containing new bandwidth |
| 58 // estimate. |
| 59 virtual void OnCongestionWindowChange(QuicTime now) OVERRIDE; |
| 60 |
| 57 virtual ~QuicServerSession(); | 61 virtual ~QuicServerSession(); |
| 58 | 62 |
| 59 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); | 63 virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config); |
| 60 | 64 |
| 61 const QuicCryptoServerStream* crypto_stream() const { | 65 const QuicCryptoServerStream* crypto_stream() const { |
| 62 return crypto_stream_.get(); | 66 return crypto_stream_.get(); |
| 63 } | 67 } |
| 64 | 68 |
| 65 // Override base class to process FEC config received from client. | 69 // Override base class to process FEC config received from client. |
| 66 virtual void OnConfigNegotiated() OVERRIDE; | 70 virtual void OnConfigNegotiated() OVERRIDE; |
| 67 | 71 |
| 72 void set_serving_region(string serving_region) { |
| 73 serving_region_ = serving_region; |
| 74 } |
| 75 |
| 68 protected: | 76 protected: |
| 69 // QuicSession methods: | 77 // QuicSession methods: |
| 70 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; | 78 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; |
| 71 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; | 79 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; |
| 72 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; | 80 virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; |
| 73 | 81 |
| 74 // If we should create an incoming stream, returns true. Otherwise | 82 // If we should create an incoming stream, returns true. Otherwise |
| 75 // does error handling, including communicating the error to the client and | 83 // does error handling, including communicating the error to the client and |
| 76 // possibly closing the connection, and returns false. | 84 // possibly closing the connection, and returns false. |
| 77 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); | 85 virtual bool ShouldCreateIncomingDataStream(QuicStreamId id); |
| 78 | 86 |
| 79 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( | 87 virtual QuicCryptoServerStream* CreateQuicCryptoServerStream( |
| 80 const QuicCryptoServerConfig& crypto_config); | 88 const QuicCryptoServerConfig& crypto_config); |
| 81 | 89 |
| 82 private: | 90 private: |
| 83 friend class test::QuicServerSessionPeer; | 91 friend class test::QuicServerSessionPeer; |
| 84 | 92 |
| 85 scoped_ptr<QuicCryptoServerStream> crypto_stream_; | 93 scoped_ptr<QuicCryptoServerStream> crypto_stream_; |
| 86 scoped_ptr<QuicPerConnectionPacketWriter> connection_packet_writer_; | 94 scoped_ptr<QuicPerConnectionPacketWriter> connection_packet_writer_; |
| 87 QuicServerSessionVisitor* visitor_; | 95 QuicServerSessionVisitor* visitor_; |
| 88 | 96 |
| 97 // The most recent bandwidth estimate sent to the client. |
| 98 QuicBandwidth bandwidth_estimate_sent_to_client_; |
| 99 |
| 100 // Text describing server location. Sent to the client as part of the bandwith |
| 101 // estimate in the source-address token. Optional, can be left empty. |
| 102 string serving_region_; |
| 103 |
| 104 // Time at which we send the last SCUP to the client. |
| 105 QuicTime last_server_config_update_time_; |
| 106 |
| 89 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); | 107 DISALLOW_COPY_AND_ASSIGN(QuicServerSession); |
| 90 }; | 108 }; |
| 91 | 109 |
| 92 } // namespace net | 110 } // namespace net |
| 93 | 111 |
| 94 #endif // NET_QUIC_QUIC_SERVER_SESSION_H_ | 112 #endif // NET_QUIC_QUIC_SERVER_SESSION_H_ |
| OLD | NEW |