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

Fix race condition in startup of capture

Fix https://github.com/GNS3/gns3-gui/issues/2111
This commit is contained in:
Julien Duponchelle 2017-07-27 15:32:46 +02:00
parent 108a659ca4
commit fc6b6b5e63
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import asyncio
import aiohttp
@ -196,9 +197,12 @@ class LinkHandler:
project = yield from Controller.instance().get_loaded_project(request.match_info["project_id"])
link = project.get_link(request.match_info["link_id"])
if link.capture_file_path is None:
while link.capture_file_path is None:
raise aiohttp.web.HTTPNotFound(text="pcap file not found")
while not os.path.isfile(link.capture_file_path):
yield from asyncio.sleep(0.5)
try:
with open(link.capture_file_path, "rb") as f: