mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
Cancellable md5sum calculation on thread, Ref. gui#2239
This commit is contained in:
1 parent
6868e20a70
commit
dc377165f2
4 files changed
+47
-2
No files matched your search
@@ -20,12 +20,17 @@ import os
|
||||
import struct
|
||||
import stat
|
||||
import asyncio
|
||||
from asyncio.futures import CancelledError
|
||||
|
||||
import aiohttp
|
||||
import socket
|
||||
import shutil
|
||||
import re
|
||||
|
||||
import logging
|
||||
|
||||
from gns3server.utils.asyncio import cancellable_wait_run_in_executor
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from uuid import UUID, uuid4
|
||||
@@ -557,7 +562,7 @@ class BaseManager:
|
||||
f.write(packet)
|
||||
os.chmod(tmp_path, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC)
|
||||
shutil.move(tmp_path, path)
|
||||
yield from wait_run_in_executor(md5sum, path)
|
||||
yield from cancellable_wait_run_in_executor(md5sum, path)
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPConflict(text="Could not write image: {} because {}".format(filename, e))
|
||||
|
||||
|
||||
Reference in new issue
Block a user