| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test_tools/server_thread.h" | 5 #include "net/tools/quic/test_tools/server_thread.h" |
| 6 | 6 |
| 7 #include "net/quic/test_tools/crypto_test_utils.h" | 7 #include "net/quic/test_tools/crypto_test_utils.h" |
| 8 #include "net/tools/quic/quic_dispatcher.h" | 8 #include "net/tools/quic/quic_dispatcher.h" |
| 9 #include "net/tools/quic/test_tools/quic_server_peer.h" | 9 #include "net/tools/quic/test_tools/quic_server_peer.h" |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void ServerThread::MaybeNotifyOfHandshakeConfirmation() { | 107 void ServerThread::MaybeNotifyOfHandshakeConfirmation() { |
| 108 if (confirmed_.IsSignaled()) { | 108 if (confirmed_.IsSignaled()) { |
| 109 // Only notify once. | 109 // Only notify once. |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 QuicDispatcher* dispatcher = QuicServerPeer::GetDispatcher(server()); | 112 QuicDispatcher* dispatcher = QuicServerPeer::GetDispatcher(server()); |
| 113 if (dispatcher->session_map().empty()) { | 113 if (dispatcher->session_map().empty()) { |
| 114 // Wait for a session to be created. | 114 // Wait for a session to be created. |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 QuicSession* session = dispatcher->session_map().begin()->second; | 117 QuicSession* session = dispatcher->session_map().begin()->second.get(); |
| 118 if (session->IsCryptoHandshakeConfirmed()) { | 118 if (session->IsCryptoHandshakeConfirmed()) { |
| 119 confirmed_.Signal(); | 119 confirmed_.Signal(); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ServerThread::ExecuteScheduledActions() { | 123 void ServerThread::ExecuteScheduledActions() { |
| 124 std::deque<std::function<void()>> actions; | 124 std::deque<std::function<void()>> actions; |
| 125 { | 125 { |
| 126 base::AutoLock lock(scheduled_actions_lock_); | 126 base::AutoLock lock(scheduled_actions_lock_); |
| 127 actions.swap(scheduled_actions_); | 127 actions.swap(scheduled_actions_); |
| 128 } | 128 } |
| 129 while (!actions.empty()) { | 129 while (!actions.empty()) { |
| 130 actions.front()(); | 130 actions.front()(); |
| 131 actions.pop_front(); | 131 actions.pop_front(); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace test | 135 } // namespace test |
| 136 } // namespace net | 136 } // namespace net |
| OLD | NEW |