OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <errno.h> | 5 #include <errno.h> |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <sys/file.h> | 7 #include <sys/file.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <iostream> | 10 #include <iostream> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/process_util.h" |
16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
17 #include "base/timer.h" | 18 #include "base/timer.h" |
18 #include "net/tools/flip_server/acceptor_thread.h" | 19 #include "net/tools/flip_server/acceptor_thread.h" |
19 #include "net/tools/flip_server/constants.h" | 20 #include "net/tools/flip_server/constants.h" |
20 #include "net/tools/flip_server/flip_config.h" | 21 #include "net/tools/flip_server/flip_config.h" |
21 #include "net/tools/flip_server/output_ordering.h" | 22 #include "net/tools/flip_server/output_ordering.h" |
22 #include "net/tools/flip_server/sm_connection.h" | 23 #include "net/tools/flip_server/sm_connection.h" |
23 #include "net/tools/flip_server/sm_interface.h" | 24 #include "net/tools/flip_server/sm_interface.h" |
24 #include "net/tools/flip_server/spdy_interface.h" | 25 #include "net/tools/flip_server/spdy_interface.h" |
25 #include "net/tools/flip_server/streamer_interface.h" | 26 #include "net/tools/flip_server/streamer_interface.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 return fd; | 158 return fd; |
158 } | 159 } |
159 | 160 |
160 int main (int argc, char**argv) | 161 int main (int argc, char**argv) |
161 { | 162 { |
162 unsigned int i = 0; | 163 unsigned int i = 0; |
163 bool wait_for_iface = false; | 164 bool wait_for_iface = false; |
164 int pidfile_fd; | 165 int pidfile_fd; |
165 | 166 |
166 signal(SIGPIPE, SIG_IGN); | 167 CHECK(base::IgnoreSigPipe()); |
167 signal(SIGTERM, SignalHandler); | 168 signal(SIGTERM, SignalHandler); |
168 signal(SIGINT, SignalHandler); | 169 signal(SIGINT, SignalHandler); |
169 signal(SIGHUP, SignalHandler); | 170 signal(SIGHUP, SignalHandler); |
170 | 171 |
171 CommandLine::Init(argc, argv); | 172 CommandLine::Init(argc, argv); |
172 CommandLine cl(argc, argv); | 173 CommandLine cl(argc, argv); |
173 | 174 |
174 if (cl.HasSwitch("help") || argc < 2) { | 175 if (cl.HasSwitch("help") || argc < 2) { |
175 cout << argv[0] << " <options>\n"; | 176 cout << argv[0] << " <options>\n"; |
176 cout << " Proxy options:\n"; | 177 cout << " Proxy options:\n"; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 break; | 409 break; |
409 } | 410 } |
410 usleep(1000*10); // 10 ms | 411 usleep(1000*10); // 10 ms |
411 } | 412 } |
412 | 413 |
413 unlink(PIDFILE); | 414 unlink(PIDFILE); |
414 close(pidfile_fd); | 415 close(pidfile_fd); |
415 return 0; | 416 return 0; |
416 } | 417 } |
417 | 418 |
OLD | NEW |