From what I understand of the code, at startup:
- minidlna starts and launches a scanner process
- at the same time, minidlna enters a loop that, when idle, lasts by default around 15 minutes
- during the loop, minidlna checks if the scanning finished. If so, the main thread sets "scanning = 0" and the inotify thread is free to start and directories start to be watched
I experianced an issue related to this behaviour: if at startup scanning lasts for more than a few seconds, then the inotify thread has to wait for a full loop to start watching directories. In practise, this means that for the first 15 minutes directories are not watched and no changes are intercepted.
This may lead to some puzzlement as to why sometimes added media are not displayed, and force users to rebuild their databases.
Maybe there is a way to set "scanning = 0" earlier in the code, e.g. directly in 'scanner.c', so that inotify can start as soon as scanning finishes?