OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| 6 #define NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| 7 |
| 8 #include "base/threading/simple_thread.h" |
| 9 #include "net/base/ip_endpoint.h" |
| 10 #include "net/quic/quic_config.h" |
| 11 #include "net/tools/quic/quic_server.h" |
| 12 |
| 13 namespace net { |
| 14 namespace tools { |
| 15 namespace test { |
| 16 |
| 17 // Simple wrapper class to run server in a thread. |
| 18 class ServerThread : public base::SimpleThread { |
| 19 public: |
| 20 ServerThread(IPEndPoint address, |
| 21 const QuicConfig& config, |
| 22 bool strike_register_no_startup_period); |
| 23 |
| 24 virtual ~ServerThread(); |
| 25 |
| 26 virtual void Run() OVERRIDE; |
| 27 |
| 28 int GetPort(); |
| 29 |
| 30 base::WaitableEvent* listening() { return &listening_; } |
| 31 base::WaitableEvent* quit() { return &quit_; } |
| 32 |
| 33 private: |
| 34 base::WaitableEvent listening_; |
| 35 base::WaitableEvent quit_; |
| 36 base::Lock port_lock_; |
| 37 tools::QuicServer server_; |
| 38 IPEndPoint address_; |
| 39 int port_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ServerThread); |
| 42 }; |
| 43 |
| 44 } // namespace test |
| 45 } // namespace tools |
| 46 } // namespace net |
| 47 |
| 48 #endif // NET_TOOLS_QUIC_SERVER_THREAD_H_ |
OLD | NEW |