From 708f66b6088df28d0fd4db37077d3482c116f0e9 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 27 Feb 2015 22:12:43 -0700 Subject: [PATCH] Fixes asyncio Lock instantiation issues on Windows. Because the event loop is essentially a global variable, asyncio Lock objects that get instantiated early could grab a reference to the wrong loop (Selector instead of Proactor). --- gns3server/modules/base_manager.py | 3 ++- gns3server/modules/dynamips/__init__.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/base_manager.py b/gns3server/modules/base_manager.py index 5c8488f7..7aec4a13 100644 --- a/gns3server/modules/base_manager.py +++ b/gns3server/modules/base_manager.py @@ -44,10 +44,11 @@ class BaseManager: Responsible of management of a VM pool """ - _convert_lock = asyncio.Lock() + _convert_lock = None def __init__(self): + BaseManager._convert_lock = asyncio.Lock() self._vms = {} self._port_manager = None self._config = Config.instance() diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index 23af464b..0b19c0be 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -105,11 +105,12 @@ class Dynamips(BaseManager): _VM_CLASS = DynamipsVM _DEVICE_CLASS = DynamipsDevice - _ghost_ios_lock = asyncio.Lock() + _ghost_ios_lock = None def __init__(self): super().__init__() + Dynamips._ghost_ios_lock = asyncio.Lock() self._devices = {} self._ghost_files = set() self._dynamips_path = None