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