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

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

Issue 340433002: Port QuicServer to Chrome network stack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments and fix blocked writers using callbacks Created 6 years, 6 months 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
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_time_wait_list_manager.h" 5 #include "net/tools/quic/quic_time_wait_list_manager.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 bool QuicTimeWaitListManager::WriteToWire(QueuedPacket* queued_packet) { 227 bool QuicTimeWaitListManager::WriteToWire(QueuedPacket* queued_packet) {
228 if (writer_->IsWriteBlocked()) { 228 if (writer_->IsWriteBlocked()) {
229 visitor_->OnWriteBlocked(this); 229 visitor_->OnWriteBlocked(this);
230 return false; 230 return false;
231 } 231 }
232 WriteResult result = writer_->WritePacket( 232 WriteResult result = writer_->WritePacket(
233 queued_packet->packet()->data(), 233 queued_packet->packet()->data(),
234 queued_packet->packet()->length(), 234 queued_packet->packet()->length(),
235 queued_packet->server_address().address(), 235 queued_packet->server_address().address(),
236 queued_packet->client_address()); 236 queued_packet->client_address(),
237 base::Callback<void(WriteResult wr)>());
237 if (result.status == WRITE_STATUS_BLOCKED) { 238 if (result.status == WRITE_STATUS_BLOCKED) {
238 // If blocked and unbuffered, return false to retry sending. 239 // If blocked and unbuffered, return false to retry sending.
239 DCHECK(writer_->IsWriteBlocked()); 240 DCHECK(writer_->IsWriteBlocked());
240 visitor_->OnWriteBlocked(this); 241 visitor_->OnWriteBlocked(this);
241 return writer_->IsWriteBlockedDataBuffered(); 242 return writer_->IsWriteBlockedDataBuffered();
242 } else if (result.status == WRITE_STATUS_ERROR) { 243 } else if (result.status == WRITE_STATUS_ERROR) {
243 LOG(WARNING) << "Received unknown error while sending reset packet to " 244 LOG(WARNING) << "Received unknown error while sending reset packet to "
244 << queued_packet->client_address().ToString() << ": " 245 << queued_packet->client_address().ToString() << ": "
245 << strerror(result.error_code); 246 << strerror(result.error_code);
246 } 247 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 282 }
282 // This connection_id has lived its age, retire it now. 283 // This connection_id has lived its age, retire it now.
283 delete it->second.close_packet; 284 delete it->second.close_packet;
284 connection_id_map_.erase(it); 285 connection_id_map_.erase(it);
285 } 286 }
286 SetConnectionIdCleanUpAlarm(); 287 SetConnectionIdCleanUpAlarm();
287 } 288 }
288 289
289 } // namespace tools 290 } // namespace tools
290 } // namespace net 291 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698