Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: net/quic/quic_server_bin.cc

Issue 938853002: quic_client should check return codes when parsing command-line flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/tools/quic/quic_client_bin.cc » ('j') | net/tools/quic/quic_client_bin.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 if (line->HasSwitch("quic_in_memory_cache_dir")) { 45 if (line->HasSwitch("quic_in_memory_cache_dir")) {
46 net::g_quic_in_memory_cache_dir = 46 net::g_quic_in_memory_cache_dir =
47 line->GetSwitchValueNative("quic_in_memory_cache_dir"); 47 line->GetSwitchValueNative("quic_in_memory_cache_dir");
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 } else {
55 LOG(ERROR) << "--port must be an integer\n";
56 return 1;
Ryan Hamilton 2015/02/18 23:51:13 Early return please: if (!base::StringToInt()) {
dougk 2015/02/19 00:29:19 Done.
54 } 57 }
55 } 58 }
56 59
57 base::AtExitManager exit_manager; 60 base::AtExitManager exit_manager;
58 base::MessageLoopForIO message_loop; 61 base::MessageLoopForIO message_loop;
59 62
60 net::IPAddressNumber ip; 63 net::IPAddressNumber ip;
61 CHECK(net::ParseIPLiteralToNumber("::", &ip)); 64 CHECK(net::ParseIPLiteralToNumber("::", &ip));
62 65
63 net::QuicConfig config; 66 net::QuicConfig config;
64 net::QuicServer server(config, net::QuicSupportedVersions()); 67 net::QuicServer server(config, net::QuicSupportedVersions());
65 68
66 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); 69 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port));
67 if (rc < 0) { 70 if (rc < 0) {
68 return 1; 71 return 1;
69 } 72 }
70 73
71 base::RunLoop().Run(); 74 base::RunLoop().Run();
72 75
73 return 0; 76 return 0;
74 } 77 }
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_client_bin.cc » ('j') | net/tools/quic/quic_client_bin.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698