SPIFFS.open and Too Many Files
Posted: Thu Oct 26, 2017 6:31 pm
BRIEF: SPIFFS can have 5 files open. On the 6th, SPIFFS.open() still returns a valid file handle. If I use available() or size() on the handle, I get zero. The problem is the code can't tell if the zero is because its the 6th file or the file is zero length. How can the code tell the difference?
DETAILS: My code is rather multi-threaded (all be it... co-operative multi-threaded) and its set up to return control to the Sketch.loop() and the next time through, if there is an available file spot, it can then open and process the file.
As work arounds, I could:
(1) Make a file counter and not let it get to 6. But then if I replace SPIFFS with something else, I'm having to revisit this web-server code.
(2) Write some code to make sure the end-users don't load some zero length files.
Both seem rather a kludge - Any suggestions?
DETAILS: My code is rather multi-threaded (all be it... co-operative multi-threaded) and its set up to return control to the Sketch.loop() and the next time through, if there is an available file spot, it can then open and process the file.
As work arounds, I could:
(1) Make a file counter and not let it get to 6. But then if I replace SPIFFS with something else, I'm having to revisit this web-server code.
(2) Write some code to make sure the end-users don't load some zero length files.
Both seem rather a kludge - Any suggestions?