| 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 // A binary wrapper for QuicServer. It listens forever on --port | 5 // A binary wrapper for QuicServer. It listens forever on --port |
| 6 // (default 6121) until it's killed or ctrl-cd to death. | 6 // (default 6121) until it's killed or ctrl-cd to death. |
| 7 | 7 |
| 8 #include <iostream> | 8 #include <iostream> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
| 16 #include "net/tools/quic/quic_in_memory_cache.h" | 16 #include "net/tools/quic/quic_in_memory_cache.h" |
| 17 #include "net/tools/quic/quic_server.h" | 17 #include "net/tools/quic/quic_server.h" |
| 18 | 18 |
| 19 // The port the quic server will listen on. | 19 // The port the quic server will listen on. |
| 20 | 20 |
| 21 int32 FLAGS_port = 6121; | 21 int32 FLAGS_port = 6121; |
| 22 | 22 |
| 23 int main(int argc, char *argv[]) { | 23 int main(int argc, char *argv[]) { |
| 24 CommandLine::Init(argc, argv); | 24 base::CommandLine::Init(argc, argv); |
| 25 CommandLine* line = CommandLine::ForCurrentProcess(); | 25 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); |
| 26 | 26 |
| 27 logging::LoggingSettings settings; | 27 logging::LoggingSettings settings; |
| 28 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 28 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 29 CHECK(logging::InitLogging(settings)); | 29 CHECK(logging::InitLogging(settings)); |
| 30 | 30 |
| 31 if (line->HasSwitch("h") || line->HasSwitch("help")) { | 31 if (line->HasSwitch("h") || line->HasSwitch("help")) { |
| 32 const char* help_str = | 32 const char* help_str = |
| 33 "Usage: quic_server [options]\n" | 33 "Usage: quic_server [options]\n" |
| 34 "\n" | 34 "\n" |
| 35 "Options:\n" | 35 "Options:\n" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 63 if (!server.Listen(net::IPEndPoint(ip, FLAGS_port))) { | 63 if (!server.Listen(net::IPEndPoint(ip, FLAGS_port))) { |
| 64 return 1; | 64 return 1; |
| 65 } | 65 } |
| 66 | 66 |
| 67 while (1) { | 67 while (1) { |
| 68 server.WaitForEvents(); | 68 server.WaitForEvents(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 return 0; | 71 return 0; |
| 72 } | 72 } |
| OLD | NEW |