1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Compute md5sum on thread and don't block main server, Ref. gui#2239

This commit is contained in:
ziajka 2018-01-26 12:53:48 +01:00
parent 3c5ca9ce0e
commit 6868e20a70
2 changed files with 2 additions and 2 deletions

View File

@ -557,7 +557,7 @@ class BaseManager:
f.write(packet) f.write(packet)
os.chmod(tmp_path, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC) os.chmod(tmp_path, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC)
shutil.move(tmp_path, path) shutil.move(tmp_path, path)
md5sum(path) yield from wait_run_in_executor(md5sum, path)
except OSError as e: except OSError as e:
raise aiohttp.web.HTTPConflict(text="Could not write image: {} because {}".format(filename, e)) raise aiohttp.web.HTTPConflict(text="Could not write image: {} because {}".format(filename, e))

View File

@ -32,7 +32,7 @@ import gns3server
import subprocess import subprocess
from gns3server.utils import parse_version from gns3server.utils import parse_version
from gns3server.utils.asyncio import subprocess_check_output from gns3server.utils.asyncio import subprocess_check_output, wait_run_in_executor
from .qemu_error import QemuError from .qemu_error import QemuError
from ..adapters.ethernet_adapter import EthernetAdapter from ..adapters.ethernet_adapter import EthernetAdapter
from ..nios.nio_udp import NIOUDP from ..nios.nio_udp import NIOUDP