Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: net/tools/quic/quic_dispatcher.cc

Issue 47283002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compilation error Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_dispatcher.h ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 19 matching lines...) Expand all
30 dispatcher_->DeleteSessions(); 30 dispatcher_->DeleteSessions();
31 return 0; 31 return 0;
32 } 32 }
33 33
34 private: 34 private:
35 QuicDispatcher* dispatcher_; 35 QuicDispatcher* dispatcher_;
36 }; 36 };
37 37
38 QuicDispatcher::QuicDispatcher(const QuicConfig& config, 38 QuicDispatcher::QuicDispatcher(const QuicConfig& config,
39 const QuicCryptoServerConfig& crypto_config, 39 const QuicCryptoServerConfig& crypto_config,
40 const QuicVersionVector& supported_versions,
40 int fd, 41 int fd,
41 EpollServer* epoll_server) 42 EpollServer* epoll_server)
42 : config_(config), 43 : config_(config),
43 crypto_config_(crypto_config), 44 crypto_config_(crypto_config),
44 time_wait_list_manager_( 45 time_wait_list_manager_(
45 new QuicTimeWaitListManager(this, epoll_server)), 46 new QuicTimeWaitListManager(this, epoll_server, supported_versions)),
46 delete_sessions_alarm_(new DeleteSessionsAlarm(this)), 47 delete_sessions_alarm_(new DeleteSessionsAlarm(this)),
47 epoll_server_(epoll_server), 48 epoll_server_(epoll_server),
48 fd_(fd), 49 fd_(fd),
49 write_blocked_(false), 50 write_blocked_(false),
50 helper_(new QuicEpollConnectionHelper(epoll_server_)), 51 helper_(new QuicEpollConnectionHelper(epoll_server_)),
51 writer_(new QuicDefaultPacketWriter(fd)) { 52 writer_(new QuicDefaultPacketWriter(fd)),
53 supported_versions_(supported_versions) {
52 } 54 }
53 55
54 QuicDispatcher::~QuicDispatcher() { 56 QuicDispatcher::~QuicDispatcher() {
55 STLDeleteValues(&session_map_); 57 STLDeleteValues(&session_map_);
56 STLDeleteElements(&closed_session_list_); 58 STLDeleteElements(&closed_session_list_);
57 } 59 }
58 60
59 void QuicDispatcher::set_fd(int fd) { 61 void QuicDispatcher::set_fd(int fd) {
60 fd_ = fd; 62 fd_ = fd;
61 writer_.reset(new QuicDefaultPacketWriter(fd)); 63 writer_.reset(new QuicDefaultPacketWriter(fd));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 time_wait_list_manager_->ProcessPacket(server_address, 97 time_wait_list_manager_->ProcessPacket(server_address,
96 client_address, 98 client_address,
97 guid, 99 guid,
98 packet); 100 packet);
99 return; 101 return;
100 } 102 }
101 session = CreateQuicSession(guid, client_address); 103 session = CreateQuicSession(guid, client_address);
102 104
103 if (session == NULL) { 105 if (session == NULL) {
104 DLOG(INFO) << "Failed to create session for " << guid; 106 DLOG(INFO) << "Failed to create session for " << guid;
105 // Add this guid fo the time-wait state, to safely nack future packets. 107 // Add this guid fo the time-wait state, to safely reject future packets.
106 // We don't know the version here, so assume latest. 108 // We don't know the version here, so assume latest.
107 time_wait_list_manager_->AddGuidToTimeWait(guid, QuicVersionMax()); 109 time_wait_list_manager_->AddGuidToTimeWait(guid,
110 supported_versions_.front());
108 time_wait_list_manager_->ProcessPacket(server_address, 111 time_wait_list_manager_->ProcessPacket(server_address,
109 client_address, 112 client_address,
110 guid, 113 guid,
111 packet); 114 packet);
112 return; 115 return;
113 } 116 }
114 DLOG(INFO) << "Created new session for " << guid; 117 DLOG(INFO) << "Created new session for " << guid;
115 session_map_.insert(make_pair(guid, session)); 118 session_map_.insert(make_pair(guid, session));
116 } else { 119 } else {
117 session = it->second; 120 session = it->second;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 198 }
196 closed_session_list_.push_back(it->second); 199 closed_session_list_.push_back(it->second);
197 CleanUpSession(it); 200 CleanUpSession(it);
198 } 201 }
199 202
200 QuicSession* QuicDispatcher::CreateQuicSession( 203 QuicSession* QuicDispatcher::CreateQuicSession(
201 QuicGuid guid, 204 QuicGuid guid,
202 const IPEndPoint& client_address) { 205 const IPEndPoint& client_address) {
203 QuicServerSession* session = new QuicServerSession( 206 QuicServerSession* session = new QuicServerSession(
204 config_, new QuicConnection(guid, client_address, helper_.get(), this, 207 config_, new QuicConnection(guid, client_address, helper_.get(), this,
205 true, QuicVersionMax()), this); 208 true, supported_versions_), this);
206 session->InitializeSession(crypto_config_); 209 session->InitializeSession(crypto_config_);
207 return session; 210 return session;
208 } 211 }
209 212
210 } // namespace tools 213 } // namespace tools
211 } // namespace net 214 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.h ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698