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

Delete old pcap file when starting a new packet capture.

This commit is contained in:
grossmj 2018-03-08 16:00:05 +07:00
parent 233e41d006
commit 38f458db7c

View File

@ -305,6 +305,12 @@ class Link:
Dump a pcap file on disk Dump a pcap file on disk
""" """
if os.path.exists(self.capture_file_path):
try:
os.remove(self.capture_file_path)
except OSError as e:
raise aiohttp.web.HTTPConflict(text="Could not delete old capture file '{}': {}".format(self.capture_file_path, e))
try: try:
stream_content = yield from self.read_pcap_from_source() stream_content = yield from self.read_pcap_from_source()
except aiohttp.web.HTTPException as e: except aiohttp.web.HTTPException as e: