Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / net / quic / quic_server_session.cc
index 1de91a4..399b772 100644 (file)
@@ -6,21 +6,26 @@
 
 #include "base/logging.h"
 #include "net/quic/quic_connection.h"
+#include "net/quic/quic_flags.h"
 #include "net/quic/quic_spdy_server_stream.h"
 #include "net/quic/reliable_quic_stream.h"
 
 namespace net {
 
-QuicServerSession::QuicServerSession(const QuicConfig& config,
-                                     QuicConnection* connection,
-                                     QuicServerSessionVisitor* visitor)
+QuicServerSession::QuicServerSession(
+    const QuicConfig& config,
+    QuicConnection* connection,
+    QuicPerConnectionPacketWriter* connection_packet_writer,
+    QuicServerSessionVisitor* visitor)
     : QuicSession(connection, config),
+      connection_packet_writer_(connection_packet_writer),
       visitor_(visitor) {}
 
 QuicServerSession::~QuicServerSession() {}
 
 void QuicServerSession::InitializeSession(
     const QuicCryptoServerConfig& crypto_config) {
+  QuicSession::InitializeSession();
   crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config));
 }
 
@@ -29,6 +34,18 @@ QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream(
   return new QuicCryptoServerStream(crypto_config, this);
 }
 
+void QuicServerSession::OnConfigNegotiated() {
+  QuicSession::OnConfigNegotiated();
+  if (!FLAGS_enable_quic_fec ||
+      !config()->HasReceivedConnectionOptions() ||
+      !ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) {
+    return;
+  }
+  // kFHDR config maps to FEC protection always for headers stream.
+  // TODO(jri): Add crypto stream in addition to headers for kHDR.
+  headers_stream_->set_fec_policy(FEC_PROTECT_ALWAYS);
+}
+
 void QuicServerSession::OnConnectionClosed(QuicErrorCode error,
                                            bool from_peer) {
   QuicSession::OnConnectionClosed(error, from_peer);