| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (!line->HasSwitch("certificate_file")) { | 70 if (!line->HasSwitch("certificate_file")) { |
| 71 LOG(ERROR) << "missing --certificate_file"; | 71 LOG(ERROR) << "missing --certificate_file"; |
| 72 return 1; | 72 return 1; |
| 73 } | 73 } |
| 74 | 74 |
| 75 if (!line->HasSwitch("key_file")) { | 75 if (!line->HasSwitch("key_file")) { |
| 76 LOG(ERROR) << "missing --key_file"; | 76 LOG(ERROR) << "missing --key_file"; |
| 77 return 1; | 77 return 1; |
| 78 } | 78 } |
| 79 | 79 |
| 80 net::IPAddress ip; | 80 net::IPAddress ip = net::IPAddress::IPv6AllZeros(); |
| 81 CHECK(ip.AssignFromIPLiteral("::")); | |
| 82 | 81 |
| 83 net::QuicConfig config; | 82 net::QuicConfig config; |
| 84 net::QuicSimpleServer server( | 83 net::QuicSimpleServer server( |
| 85 CreateProofSource(line->GetSwitchValuePath("certificate_file"), | 84 CreateProofSource(line->GetSwitchValuePath("certificate_file"), |
| 86 line->GetSwitchValuePath("key_file")), | 85 line->GetSwitchValuePath("key_file")), |
| 87 config, net::QuicSupportedVersions()); | 86 config, net::QuicSupportedVersions()); |
| 88 server.SetStrikeRegisterNoStartupPeriod(); | 87 server.SetStrikeRegisterNoStartupPeriod(); |
| 89 | 88 |
| 90 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); | 89 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); |
| 91 if (rc < 0) { | 90 if (rc < 0) { |
| 92 return 1; | 91 return 1; |
| 93 } | 92 } |
| 94 | 93 |
| 95 base::RunLoop().Run(); | 94 base::RunLoop().Run(); |
| 96 | 95 |
| 97 return 0; | 96 return 0; |
| 98 } | 97 } |
| OLD | NEW |