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

Side by Side Diff: net/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 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 #include "net/quic/quic_time_wait_list_manager.h" 5 #include "net/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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 bool QuicTimeWaitListManager::WriteToWire(QueuedPacket* queued_packet) { 225 bool QuicTimeWaitListManager::WriteToWire(QueuedPacket* queued_packet) {
226 if (writer_->IsWriteBlocked()) { 226 if (writer_->IsWriteBlocked()) {
227 visitor_->OnWriteBlocked(this); 227 visitor_->OnWriteBlocked(this);
228 return false; 228 return false;
229 } 229 }
230 WriteResult result = writer_->WritePacket( 230 WriteResult result = writer_->WritePacket(
231 queued_packet->packet()->data(), 231 queued_packet->packet()->data(),
232 queued_packet->packet()->length(), 232 queued_packet->packet()->length(),
233 queued_packet->server_address().address(), 233 queued_packet->server_address().address(),
234 queued_packet->client_address()); 234 queued_packet->client_address(),
235 base::Callback<void(WriteResult wr)>());
235 if (result.status == WRITE_STATUS_BLOCKED) { 236 if (result.status == WRITE_STATUS_BLOCKED) {
236 // If blocked and unbuffered, return false to retry sending. 237 // If blocked and unbuffered, return false to retry sending.
237 DCHECK(writer_->IsWriteBlocked()); 238 DCHECK(writer_->IsWriteBlocked());
238 visitor_->OnWriteBlocked(this); 239 visitor_->OnWriteBlocked(this);
239 return writer_->IsWriteBlockedDataBuffered(); 240 return writer_->IsWriteBlockedDataBuffered();
240 } else if (result.status == WRITE_STATUS_ERROR) { 241 } else if (result.status == WRITE_STATUS_ERROR) {
241 LOG(WARNING) << "Received unknown error while sending reset packet to " 242 LOG(WARNING) << "Received unknown error while sending reset packet to "
242 << queued_packet->client_address().ToString() << ": " 243 << queued_packet->client_address().ToString() << ": "
243 << strerror(result.error_code); 244 << strerror(result.error_code);
244 } 245 }
(...skipping 29 matching lines...) Expand all
274 break; 275 break;
275 } 276 }
276 // This connection_id has lived its age, retire it now. 277 // This connection_id has lived its age, retire it now.
277 delete it->second.close_packet; 278 delete it->second.close_packet;
278 connection_id_map_.erase(it); 279 connection_id_map_.erase(it);
279 } 280 }
280 SetConnectionIdCleanUpAlarm(); 281 SetConnectionIdCleanUpAlarm();
281 } 282 }
282 283
283 } // namespace net 284 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698