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

Side by Side Diff: client/cros/dns_server.py

Issue 6626031: Fix import of some autotest cros modules, make them callable outside of autotest runtime. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 9 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 | « client/cros/cryptohome.py ('k') | client/cros/tpm.py » ('j') | 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 logging, threading, time, utils 5 import logging, threading, time
6 from autotest_lib.client.bin import utils
6 7
7 class LocalDns(object): 8 class LocalDns(object):
8 """a wrapper around miniFakeDns that handles managing running the server 9 """a wrapper around miniFakeDns that handles managing running the server
9 in a separate thread. 10 in a separate thread.
10 """ 11 """
11 12
12 def __init__(self, fake_ip="127.0.0.1", local_port=53): 13 def __init__(self, fake_ip="127.0.0.1", local_port=53):
13 import miniFakeDns # So we don't need to install it in the chroot. 14 import miniFakeDns # So we don't need to install it in the chroot.
14 self._dns = miniFakeDns.DNSServer(fake_ip="127.0.0.1", port=local_port) 15 self._dns = miniFakeDns.DNSServer(fake_ip="127.0.0.1", port=local_port)
15 self._stopper = threading.Event() 16 self._stopper = threading.Event()
16 self._thread = threading.Thread(target=self._dns.run, 17 self._thread = threading.Thread(target=self._dns.run,
17 args=(self._stopper,)) 18 args=(self._stopper,))
18 19
19 20
20 def run(self): 21 def run(self):
21 self._thread.start() 22 self._thread.start()
22 23
23 24
24 def stop(self): 25 def stop(self):
25 self._stopper.set() 26 self._stopper.set()
26 self._thread.join() 27 self._thread.join()
OLDNEW
« no previous file with comments | « client/cros/cryptohome.py ('k') | client/cros/tpm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698