Commit 56a4a0d9 authored by Kliment Yanev's avatar Kliment Yanev

Fix escalating memory usage when multiple large files are printed after each other.

React to resend only when the command is in the beginning of a line.
parent aa0a045e
......@@ -114,11 +114,11 @@ class printcore():
pass
#callback for errors
pass
if "resend" in line.lower() or "rs" in line:
if line.lower().startswith("resend") or line.startswith("rs"):
try:
toresend=int(line.replace("N:"," ").replace("N"," ").replace(":"," ").split()[-1])
except:
if "rs" in line:
if line.startswith("rs"):
toresend=int(line.split()[1])
self.resendfrom=toresend
self.clear=True
......@@ -195,6 +195,8 @@ class printcore():
pass
while(self.printing and self.printer and self.online):
self._sendnext()
self.log=[]
self.sent=[]
if self.endcb is not None:
try:
self.endcb()
......@@ -215,6 +217,7 @@ class printcore():
self._send(self.sentlines[self.resendfrom],self.resendfrom,False)
self.resendfrom+=1
return
self.sentlines={}
self.resendfrom=-1
for i in self.priqueue[:]:
self._send(i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment