| 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 <stdio.h> | 7 #include <stdio.h> |
| 8 #include <sys/file.h> | 8 #include <sys/file.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 | 10 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 // Proxy Acceptors | 280 // Proxy Acceptors |
| 281 while (true) { | 281 while (true) { |
| 282 i += 1; | 282 i += 1; |
| 283 std::stringstream name; | 283 std::stringstream name; |
| 284 name << "proxy" << i; | 284 name << "proxy" << i; |
| 285 if (!cl.HasSwitch(name.str())) { | 285 if (!cl.HasSwitch(name.str())) { |
| 286 break; | 286 break; |
| 287 } | 287 } |
| 288 std::string value = cl.GetSwitchValueASCII(name.str()); | 288 std::string value = cl.GetSwitchValueASCII(name.str()); |
| 289 std::vector<std::string> valueArgs; | 289 std::vector<std::string> valueArgs = base::SplitString( |
| 290 base::SplitString(value, ',', &valueArgs); | 290 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 291 CHECK_EQ((unsigned int)9, valueArgs.size()); | 291 CHECK_EQ((unsigned int)9, valueArgs.size()); |
| 292 int spdy_only = atoi(valueArgs[8].c_str()); | 292 int spdy_only = atoi(valueArgs[8].c_str()); |
| 293 // If wait_for_iface is enabled, then this call will block | 293 // If wait_for_iface is enabled, then this call will block |
| 294 // indefinitely until the interface is raised. | 294 // indefinitely until the interface is raised. |
| 295 g_proxy_config.AddAcceptor(net::FLIP_HANDLER_PROXY, | 295 g_proxy_config.AddAcceptor(net::FLIP_HANDLER_PROXY, |
| 296 valueArgs[0], | 296 valueArgs[0], |
| 297 valueArgs[1], | 297 valueArgs[1], |
| 298 valueArgs[2], | 298 valueArgs[2], |
| 299 valueArgs[3], | 299 valueArgs[3], |
| 300 valueArgs[4], | 300 valueArgs[4], |
| 301 valueArgs[5], | 301 valueArgs[5], |
| 302 valueArgs[6], | 302 valueArgs[6], |
| 303 valueArgs[7], | 303 valueArgs[7], |
| 304 spdy_only, | 304 spdy_only, |
| 305 FLAGS_accept_backlog_size, | 305 FLAGS_accept_backlog_size, |
| 306 FLAGS_disable_nagle, | 306 FLAGS_disable_nagle, |
| 307 FLAGS_accepts_per_wake, | 307 FLAGS_accepts_per_wake, |
| 308 FLAGS_reuseport, | 308 FLAGS_reuseport, |
| 309 wait_for_iface, | 309 wait_for_iface, |
| 310 NULL); | 310 NULL); |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Spdy Server Acceptor | 313 // Spdy Server Acceptor |
| 314 net::MemoryCache spdy_memory_cache; | 314 net::MemoryCache spdy_memory_cache; |
| 315 if (cl.HasSwitch("spdy-server")) { | 315 if (cl.HasSwitch("spdy-server")) { |
| 316 spdy_memory_cache.AddFiles(); | 316 spdy_memory_cache.AddFiles(); |
| 317 std::string value = cl.GetSwitchValueASCII("spdy-server"); | 317 std::string value = cl.GetSwitchValueASCII("spdy-server"); |
| 318 std::vector<std::string> valueArgs; | 318 std::vector<std::string> valueArgs = base::SplitString( |
| 319 base::SplitString(value, ',', &valueArgs); | 319 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 320 while (valueArgs.size() < 4) | 320 while (valueArgs.size() < 4) |
| 321 valueArgs.push_back(std::string()); | 321 valueArgs.push_back(std::string()); |
| 322 g_proxy_config.AddAcceptor(net::FLIP_HANDLER_SPDY_SERVER, | 322 g_proxy_config.AddAcceptor(net::FLIP_HANDLER_SPDY_SERVER, |
| 323 valueArgs[0], | 323 valueArgs[0], |
| 324 valueArgs[1], | 324 valueArgs[1], |
| 325 valueArgs[2], | 325 valueArgs[2], |
| 326 valueArgs[3], | 326 valueArgs[3], |
| 327 std::string(), | 327 std::string(), |
| 328 std::string(), | 328 std::string(), |
| 329 std::string(), | 329 std::string(), |
| 330 std::string(), | 330 std::string(), |
| 331 0, | 331 0, |
| 332 FLAGS_accept_backlog_size, | 332 FLAGS_accept_backlog_size, |
| 333 FLAGS_disable_nagle, | 333 FLAGS_disable_nagle, |
| 334 FLAGS_accepts_per_wake, | 334 FLAGS_accepts_per_wake, |
| 335 FLAGS_reuseport, | 335 FLAGS_reuseport, |
| 336 wait_for_iface, | 336 wait_for_iface, |
| 337 &spdy_memory_cache); | 337 &spdy_memory_cache); |
| 338 } | 338 } |
| 339 | 339 |
| 340 // Spdy Server Acceptor | 340 // Spdy Server Acceptor |
| 341 net::MemoryCache http_memory_cache; | 341 net::MemoryCache http_memory_cache; |
| 342 if (cl.HasSwitch("http-server")) { | 342 if (cl.HasSwitch("http-server")) { |
| 343 http_memory_cache.AddFiles(); | 343 http_memory_cache.AddFiles(); |
| 344 std::string value = cl.GetSwitchValueASCII("http-server"); | 344 std::string value = cl.GetSwitchValueASCII("http-server"); |
| 345 std::vector<std::string> valueArgs; | 345 std::vector<std::string> valueArgs = base::SplitString( |
| 346 base::SplitString(value, ',', &valueArgs); | 346 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 347 while (valueArgs.size() < 4) | 347 while (valueArgs.size() < 4) |
| 348 valueArgs.push_back(std::string()); | 348 valueArgs.push_back(std::string()); |
| 349 g_proxy_config.AddAcceptor(net::FLIP_HANDLER_HTTP_SERVER, | 349 g_proxy_config.AddAcceptor(net::FLIP_HANDLER_HTTP_SERVER, |
| 350 valueArgs[0], | 350 valueArgs[0], |
| 351 valueArgs[1], | 351 valueArgs[1], |
| 352 valueArgs[2], | 352 valueArgs[2], |
| 353 valueArgs[3], | 353 valueArgs[3], |
| 354 std::string(), | 354 std::string(), |
| 355 std::string(), | 355 std::string(), |
| 356 std::string(), | 356 std::string(), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 400 } |
| 401 break; | 401 break; |
| 402 } | 402 } |
| 403 usleep(1000 * 10); // 10 ms | 403 usleep(1000 * 10); // 10 ms |
| 404 } | 404 } |
| 405 | 405 |
| 406 unlink(PIDFILE); | 406 unlink(PIDFILE); |
| 407 close(pidfile_fd); | 407 close(pidfile_fd); |
| 408 return 0; | 408 return 0; |
| 409 } | 409 } |
| OLD | NEW |