| 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 #include <cstdio> | 5 #include <cstdio> |
| 6 #include <cstdlib> | 6 #include <cstdlib> |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 g_counter.Get().last_printout = now; | 116 g_counter.Get().last_printout = now; |
| 117 } | 117 } |
| 118 base::MessageLoopProxy::current()->PostDelayedTask( | 118 base::MessageLoopProxy::current()->PostDelayedTask( |
| 119 FROM_HERE, | 119 FROM_HERE, |
| 120 base::Bind(&CheckByteCounters), | 120 base::Bind(&CheckByteCounters), |
| 121 base::TimeDelta::FromMilliseconds(100)); | 121 base::TimeDelta::FromMilliseconds(100)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 int main(int argc, char** argv) { | 124 int main(int argc, char** argv) { |
| 125 base::AtExitManager at_exit; | 125 base::AtExitManager at_exit; |
| 126 CommandLine::Init(argc, argv); | 126 base::CommandLine::Init(argc, argv); |
| 127 logging::LoggingSettings settings; | 127 logging::LoggingSettings settings; |
| 128 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 128 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 129 InitLogging(settings); | 129 InitLogging(settings); |
| 130 | 130 |
| 131 if (argc != 5 && argc != 3) { | 131 if (argc != 5 && argc != 3) { |
| 132 fprintf(stderr, | 132 fprintf(stderr, |
| 133 "Usage: udp_proxy <localport> <remotehost> <remoteport> <type>\n" | 133 "Usage: udp_proxy <localport> <remotehost> <remoteport> <type>\n" |
| 134 "or:\n" | 134 "or:\n" |
| 135 " udp_proxy <localport> <type>\n" | 135 " udp_proxy <localport> <type>\n" |
| 136 "Where type is one of: perfect, wifi, bad, evil, poisson-wifi\n"); | 136 "Where type is one of: perfect, wifi, bad, evil, poisson-wifi\n"); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 remote_endpoint, | 197 remote_endpoint, |
| 198 in_pipe.Pass(), | 198 in_pipe.Pass(), |
| 199 out_pipe.Pass(), | 199 out_pipe.Pass(), |
| 200 NULL)); | 200 NULL)); |
| 201 base::MessageLoop message_loop; | 201 base::MessageLoop message_loop; |
| 202 g_counter.Get().last_printout = base::TimeTicks::Now(); | 202 g_counter.Get().last_printout = base::TimeTicks::Now(); |
| 203 CheckByteCounters(); | 203 CheckByteCounters(); |
| 204 message_loop.Run(); | 204 message_loop.Run(); |
| 205 return 1; | 205 return 1; |
| 206 } | 206 } |
| OLD | NEW |