1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Remove unnecessary locks.

This commit is contained in:
Jeremy 2015-03-20 19:19:49 -06:00
parent 5b08677537
commit 17d5b3a7bc

View File

@ -58,7 +58,6 @@ class DynamipsHypervisor:
self._uuid = None
self._reader = None
self._writer = None
self._io_lock = asyncio.Lock()
@asyncio.coroutine
@ -82,7 +81,6 @@ class DynamipsHypervisor:
while time.time() - begin < timeout:
yield from asyncio.sleep(0.01)
try:
with (yield from self._io_lock):
self._reader, self._writer = yield from asyncio.open_connection(host, self._port)
except OSError as e:
last_exception = e
@ -123,7 +121,6 @@ class DynamipsHypervisor:
"""
yield from self.send("hypervisor close")
with (yield from self._io_lock):
self._writer.close()
self._reader, self._writer = None
@ -133,7 +130,6 @@ class DynamipsHypervisor:
Stops this hypervisor (will no longer run).
"""
with (yield from self._io_lock):
try:
# try to properly stop the hypervisor
yield from self.send("hypervisor stop")
@ -283,7 +279,7 @@ class DynamipsHypervisor:
.format(host=self._host, port=self._port, run=self.is_running()))
buf += chunk.decode()
except OSError as e:
raise DynamipsError("Communication timed out with {host}:{port} :{error}, Dynamips process running: {run}"
raise DynamipsError("Lost communication with {host}:{port} :{error}, Dynamips process running: {run}"
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
# If the buffer doesn't end in '\n' then we can't be done