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

Side by Side Diff: lib/cros_test_proxy.py

Issue 6331007: Use different proxy ports, and log port conflicts. Hopefully works around (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « bin/cros_au_test_harness.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS 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 import select 5 import select
6 import socket 6 import socket
7 import SocketServer 7 import SocketServer
8 import threading 8 import threading
9 9
10 class Filter(object): 10 class Filter(object):
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 filter: An instance of a subclass of Filter. 93 filter: An instance of a subclass of Filter.
94 port_in: Port on which to listen for incoming connections. 94 port_in: Port on which to listen for incoming connections.
95 address_out: Address to which outgoing connections will go. 95 address_out: Address to which outgoing connections will go.
96 address_port: Port to which outgoing connections will go. 96 address_port: Port to which outgoing connections will go.
97 """ 97 """
98 self.port_in = port_in 98 self.port_in = port_in
99 self.address_out = address_out 99 self.address_out = address_out
100 self.port_out = port_out 100 self.port_out = port_out
101 self.filter = filter 101 self.filter = filter
102 102
103 SocketServer.TCPServer.__init__(self, 103 try:
104 ('', port_in), 104 SocketServer.TCPServer.__init__(self,
105 self._Handler) 105 ('', port_in),
106 self._Handler)
107 except socket.error:
108 import os
sosa 2011/01/19 20:07:55 please import os at the top
109 os.system("sudo netstat -l --tcp -n -p")
sosa 2011/01/19 20:07:55 use '' rather than "" to be consistent.
110 raise
106 111
107 def serve_forever_in_thread(self): 112 def serve_forever_in_thread(self):
108 """Helper method to start the server in a new background thread.""" 113 """Helper method to start the server in a new background thread."""
109 server_thread = threading.Thread(target=self.serve_forever) 114 server_thread = threading.Thread(target=self.serve_forever)
110 server_thread.setDaemon(True) 115 server_thread.setDaemon(True)
111 server_thread.start() 116 server_thread.start()
112 117
113 return server_thread 118 return server_thread
OLDNEW
« no previous file with comments | « bin/cros_au_test_harness.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698