| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 if (line->HasSwitch("port")) { | 50 if (line->HasSwitch("port")) { |
| 51 int port; | 51 int port; |
| 52 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { | 52 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { |
| 53 FLAGS_port = port; | 53 FLAGS_port = port; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 base::AtExitManager exit_manager; | 57 base::AtExitManager exit_manager; |
| 58 | |
| 59 base::MessageLoopForIO message_loop; | 58 base::MessageLoopForIO message_loop; |
| 60 | 59 |
| 61 net::IPAddressNumber ip; | 60 net::IPAddressNumber ip; |
| 62 CHECK(net::ParseIPLiteralToNumber("::", &ip)); | 61 CHECK(net::ParseIPLiteralToNumber("::", &ip)); |
| 63 | 62 |
| 64 net::QuicConfig config; | 63 net::QuicConfig config; |
| 65 config.SetDefaults(); | |
| 66 | |
| 67 net::QuicServer server(config, net::QuicSupportedVersions()); | 64 net::QuicServer server(config, net::QuicSupportedVersions()); |
| 68 | 65 |
| 69 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); | 66 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); |
| 70 if (rc < 0) { | 67 if (rc < 0) { |
| 71 return 1; | 68 return 1; |
| 72 } | 69 } |
| 73 | 70 |
| 74 base::RunLoop().Run(); | 71 base::RunLoop().Run(); |
| 75 | 72 |
| 76 return 0; | 73 return 0; |
| 77 } | 74 } |
| OLD | NEW |