mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-22 15:11:10 +02:00
This started as a simple unit-test for file chunker, but the first test hung immediately, so I started looking into the code. One problem was that when entering inotify() code, ctx cancel wasn't considered. Another problem is that remove fsnotify was never triggered, but I saw that with unit-test later. Small nit was that inotify() was initialized every time we got to EOF, which is not efficient for "follow" mode. So I moved inotify into the main loop, and plugged context cancel watch into the place when chunk is delivered. Chunker code is supposed to block in two places: when it tries to deliver next chunk (as client might be slow to recieve buffers) or when there's no new data (on inotify). So it makes sense to assert context canceled condition in both cases. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>