@@ -43,7 +43,7 @@ def __init__(
43
43
ip ,
44
44
port = 21 ,
45
45
authlist = {},
46
- maxcache = 5 ,
46
+ maxcache = 2 ,
47
47
maxbuf = 2880 ,
48
48
auth_timeout = 120 ,
49
49
verbose = False ,
@@ -273,6 +273,10 @@ def poll(self) -> bool:
273
273
if self .verbose :
274
274
print ("Done with command." )
275
275
del command , data
276
+ collect ()
277
+ collect ()
278
+ collect ()
279
+ collect ()
276
280
del raw , cmds
277
281
except UnicodeError :
278
282
pass
@@ -386,6 +390,8 @@ def _retr(self, data) -> None:
386
390
with open (filen , "r" if self .mode else "rb" ) as f :
387
391
self ._send_msg (17 )
388
392
while True :
393
+ collect ()
394
+ collect ()
389
395
dat = f .read (self .tx_size ) # Reading in chunks
390
396
if not dat :
391
397
del dat
@@ -399,8 +405,6 @@ def _retr(self, data) -> None:
399
405
except OSError :
400
406
self ._send_msg (18 )
401
407
self ._disable_data ()
402
- collect ()
403
- collect ()
404
408
405
409
def _stor (self , data , append = False ) -> None :
406
410
if not self ._authcheck ():
@@ -429,6 +433,7 @@ def _stor(self, data, append=False) -> None:
429
433
f .write (bytes (memoryview (self ._file_cache )[:cache_stored ]))
430
434
cache_stored = 0
431
435
collect ()
436
+ collect ()
432
437
self ._file_cache [cache_stored :size ] = memoryview (self ._rx_buf )[
433
438
:size
434
439
]
@@ -441,15 +446,15 @@ def _stor(self, data, append=False) -> None:
441
446
if cache_stored :
442
447
f .write (bytes (memoryview (self ._file_cache )[:cache_stored ]))
443
448
collect ()
449
+ collect ()
444
450
self ._send_msg (19 )
445
451
remount ("/" , True )
446
452
except RuntimeError :
447
453
self ._send_msg (20 )
448
454
except OSError : # Append failed
449
455
self ._send_msg (18 )
450
456
self ._disable_data ()
451
- collect ()
452
- collect ()
457
+
453
458
454
459
def _type (self , data ) -> None :
455
460
if not self ._authcheck ():
0 commit comments