OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 bool QuicDispatcher::HasPendingWrites() const { | 384 bool QuicDispatcher::HasPendingWrites() const { |
385 return !write_blocked_list_.empty(); | 385 return !write_blocked_list_.empty(); |
386 } | 386 } |
387 | 387 |
388 void QuicDispatcher::Shutdown() { | 388 void QuicDispatcher::Shutdown() { |
389 while (!session_map_.empty()) { | 389 while (!session_map_.empty()) { |
390 QuicServerSession* session = session_map_.begin()->second; | 390 QuicServerSession* session = session_map_.begin()->second; |
391 session->connection()->SendConnectionClose(QUIC_PEER_GOING_AWAY); | 391 session->connection()->SendConnectionCloseWithDetails( |
| 392 QUIC_PEER_GOING_AWAY, "Server shutdown imminent"); |
392 // Validate that the session removes itself from the session map on close. | 393 // Validate that the session removes itself from the session map on close. |
393 DCHECK(session_map_.empty() || session_map_.begin()->second != session); | 394 DCHECK(session_map_.empty() || session_map_.begin()->second != session); |
394 } | 395 } |
395 DeleteSessions(); | 396 DeleteSessions(); |
396 } | 397 } |
397 | 398 |
398 void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id, | 399 void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id, |
399 QuicErrorCode error) { | 400 QuicErrorCode error) { |
400 SessionMap::iterator it = session_map_.find(connection_id); | 401 SessionMap::iterator it = session_map_.find(connection_id); |
401 if (it == session_map_.end()) { | 402 if (it == session_map_.end()) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // send it to the time wait manager in OnUnathenticatedHeader. | 482 // send it to the time wait manager in OnUnathenticatedHeader. |
482 return true; | 483 return true; |
483 } | 484 } |
484 | 485 |
485 void QuicDispatcher::SetLastError(QuicErrorCode error) { | 486 void QuicDispatcher::SetLastError(QuicErrorCode error) { |
486 last_error_ = error; | 487 last_error_ = error; |
487 } | 488 } |
488 | 489 |
489 } // namespace tools | 490 } // namespace tools |
490 } // namespace net | 491 } // namespace net |
OLD | NEW |