| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import inspect | 4 import inspect |
| 5 import socket | 5 import socket |
| 6 import time | 6 import time |
| 7 | 7 |
| 8 class TimeoutException(Exception): | 8 class TimeoutException(Exception): |
| 9 pass | 9 pass |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 self.local_port = local_port | 59 self.local_port = local_port |
| 60 self.remote_port = remote_port | 60 self.remote_port = remote_port |
| 61 | 61 |
| 62 def GetAvailableLocalPort(): | 62 def GetAvailableLocalPort(): |
| 63 tmp = socket.socket() | 63 tmp = socket.socket() |
| 64 tmp.bind(('', 0)) | 64 tmp.bind(('', 0)) |
| 65 port = tmp.getsockname()[1] | 65 port = tmp.getsockname()[1] |
| 66 tmp.close() | 66 tmp.close() |
| 67 | 67 |
| 68 return port | 68 return port |
| OLD | NEW |