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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/servers/server_base.py

Issue 464543003: Set SO_REUSEADDR on layout test server sockets on non-Windows systems (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 raise 254 raise
255 _log.debug("Server NOT running on %d: %s" % (port, e)) 255 _log.debug("Server NOT running on %d: %s" % (port, e))
256 return False 256 return False
257 finally: 257 finally:
258 s.close() 258 s.close()
259 return True 259 return True
260 260
261 def _check_that_all_ports_are_available(self): 261 def _check_that_all_ports_are_available(self):
262 for mapping in self._mappings: 262 for mapping in self._mappings:
263 s = socket.socket() 263 s = socket.socket()
264 # s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 264 if not self._platform.is_win():
265 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
265 port = mapping['port'] 266 port = mapping['port']
266 try: 267 try:
267 s.bind(('localhost', port)) 268 s.bind(('localhost', port))
268 except IOError, e: 269 except IOError, e:
269 if e.errno in (errno.EALREADY, errno.EADDRINUSE): 270 if e.errno in (errno.EALREADY, errno.EADDRINUSE):
270 raise ServerError('Port %d is already in use.' % port) 271 raise ServerError('Port %d is already in use.' % port)
271 elif self._platform.is_win() and e.errno in (errno.WSAEACCES,): # pylint: disable=E1101 272 elif self._platform.is_win() and e.errno in (errno.WSAEACCES,): # pylint: disable=E1101
272 raise ServerError('Port %d is already in use.' % port) 273 raise ServerError('Port %d is already in use.' % port)
273 else: 274 else:
274 raise 275 raise
275 finally: 276 finally:
276 s.close() 277 s.close()
277 _log.debug('all ports are available') 278 _log.debug('all ports are available')
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