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

Side by Side Diff: build/android/pylib/forwarder.py

Issue 18714004: Make port unmapping errors non fatal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | « no previous file | 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) 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 4
5 import logging 5 import logging
6 import os 6 import os
7 import re 7 import re
8 import sys 8 import sys
9 import threading 9 import threading
10 import time 10 import time
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 def _UnmapDevicePortInternalLocked(self, device_port): 122 def _UnmapDevicePortInternalLocked(self, device_port):
123 if not device_port in self._device_to_host_port_map: 123 if not device_port in self._device_to_host_port_map:
124 return 124 return
125 redirection_command = [ 125 redirection_command = [
126 '--serial-id=' + self._adb.Adb().GetSerialNumber(), '--unmap', 126 '--serial-id=' + self._adb.Adb().GetSerialNumber(), '--unmap',
127 str(device_port)] 127 str(device_port)]
128 (exit_code, output) = cmd_helper.GetCmdStatusAndOutput( 128 (exit_code, output) = cmd_helper.GetCmdStatusAndOutput(
129 [self._host_forwarder_path] + redirection_command) 129 [self._host_forwarder_path] + redirection_command)
130 if exit_code != 0: 130 if exit_code != 0:
131 raise Exception('%s exited with %d:\n%s' % ( 131 logging.error('%s exited with %d:\n%s' % (
132 self._host_forwarder_path, exit_code, '\n'.join(output))) 132 self._host_forwarder_path, exit_code, '\n'.join(output)))
133 host_port = self._device_to_host_port_map[device_port] 133 host_port = self._device_to_host_port_map[device_port]
134 del self._device_to_host_port_map[device_port] 134 del self._device_to_host_port_map[device_port]
135 del self._host_to_device_port_map[host_port] 135 del self._host_to_device_port_map[host_port]
136 136
137 @staticmethod 137 @staticmethod
138 def KillHost(build_type='Debug'): 138 def KillHost(build_type='Debug'):
139 """Kills the forwarder process running on the host. 139 """Kills the forwarder process running on the host.
140 140
141 Args: 141 Args:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 def DevicePortForHostPort(self, host_port): 184 def DevicePortForHostPort(self, host_port):
185 """Returns the device port that corresponds to a given host port.""" 185 """Returns the device port that corresponds to a given host port."""
186 with self._lock: 186 with self._lock:
187 return self._host_to_device_port_map.get(host_port) 187 return self._host_to_device_port_map.get(host_port)
188 188
189 def Close(self): 189 def Close(self):
190 """Releases the previously forwarded ports.""" 190 """Releases the previously forwarded ports."""
191 with self._lock: 191 with self._lock:
192 for device_port in self._device_to_host_port_map.copy(): 192 for device_port in self._device_to_host_port_map.copy():
193 self._UnmapDevicePortInternalLocked(device_port) 193 self._UnmapDevicePortInternalLocked(device_port)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698