| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (!base::StringToInt(line->GetSwitchValueASCII("port"), &FLAGS_port)) { | 64 if (!base::StringToInt(line->GetSwitchValueASCII("port"), &FLAGS_port)) { |
| 65 LOG(ERROR) << "--port must be an integer\n"; | 65 LOG(ERROR) << "--port must be an integer\n"; |
| 66 return 1; | 66 return 1; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 net::IPAddressNumber ip; | 70 net::IPAddressNumber ip; |
| 71 CHECK(net::ParseIPLiteralToNumber("::", &ip)); | 71 CHECK(net::ParseIPLiteralToNumber("::", &ip)); |
| 72 | 72 |
| 73 net::QuicConfig config; | 73 net::QuicConfig config; |
| 74 net::tools::QuicServer server(config, net::QuicSupportedVersions()); | 74 net::tools::QuicServer server( |
| 75 CreateProofSource(line->GetSwitchValuePath("certificate_file"), |
| 76 line->GetSwitchValuePath("key_file")), |
| 77 config, net::QuicSupportedVersions()); |
| 75 server.SetStrikeRegisterNoStartupPeriod(); | 78 server.SetStrikeRegisterNoStartupPeriod(); |
| 76 if (!line->HasSwitch("certificate_file")) { | 79 if (!line->HasSwitch("certificate_file")) { |
| 77 LOG(ERROR) << "missing --certificate_file"; | 80 LOG(ERROR) << "missing --certificate_file"; |
| 78 return 1; | 81 return 1; |
| 79 } | 82 } |
| 80 if (!line->HasSwitch("key_file")) { | 83 if (!line->HasSwitch("key_file")) { |
| 81 LOG(ERROR) << "missing --key_file"; | 84 LOG(ERROR) << "missing --key_file"; |
| 82 return 1; | 85 return 1; |
| 83 } | 86 } |
| 84 server.SetProofSource( | |
| 85 CreateProofSource(line->GetSwitchValuePath("certificate_file"), | |
| 86 line->GetSwitchValuePath("key_file"))); | |
| 87 | 87 |
| 88 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); | 88 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); |
| 89 if (rc < 0) { | 89 if (rc < 0) { |
| 90 return 1; | 90 return 1; |
| 91 } | 91 } |
| 92 | 92 |
| 93 while (1) { | 93 while (1) { |
| 94 server.WaitForEvents(); | 94 server.WaitForEvents(); |
| 95 } | 95 } |
| 96 } | 96 } |
| OLD | NEW |