Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
ramant (doing other things)
2013/09/25 14:39:12
nit: consider changing 2012 to 2013.
Ryan Hamilton
2013/09/25 23:29:36
Done. Although there's a script which does this f
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/tools/quic/test_tools/server_thread.h" | |
| 6 | |
| 7 namespace net { | |
| 8 namespace tools { | |
| 9 namespace test { | |
| 10 | |
| 11 ServerThread::ServerThread(IPEndPoint address, | |
| 12 const QuicConfig& config, | |
| 13 bool strike_register_no_startup_period) | |
| 14 : SimpleThread("server_thread"), | |
| 15 listening_(true, false), | |
| 16 quit_(true, false), | |
| 17 server_(config), | |
| 18 address_(address), | |
| 19 port_(0) { | |
| 20 if (strike_register_no_startup_period) { | |
| 21 server_.SetStrikeRegisterNoStartupPeriod(); | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 ServerThread::~ServerThread() { | |
| 26 } | |
| 27 | |
| 28 void ServerThread::Run() { | |
| 29 LOG(INFO) << "listening"; | |
| 30 server_.Listen(address_); | |
| 31 | |
| 32 port_lock_.Acquire(); | |
| 33 port_ = server_.port(); | |
| 34 port_lock_.Release(); | |
| 35 | |
| 36 listening_.Signal(); | |
| 37 while (!quit_.IsSignaled()) { | |
| 38 //LOG(INFO) << "waiting"; | |
| 39 server_.WaitForEvents(); | |
|
ramant (doing other things)
2013/09/25 14:39:12
nit: //LOG(INFO) -> // LOG(INFO)
Ryan Hamilton
2013/09/25 23:29:36
Done.
| |
| 40 } | |
| 41 LOG(INFO) << "shutdown"; | |
| 42 server_.Shutdown(); | |
| 43 } | |
| 44 | |
| 45 int ServerThread::GetPort() { | |
| 46 port_lock_.Acquire(); | |
| 47 int rc = port_; | |
| 48 port_lock_.Release(); | |
| 49 return rc; | |
| 50 } | |
| 51 | |
| 52 } // namespace test | |
| 53 } // namespace tools | |
| 54 } // namespace net | |
| OLD | NEW |