Combine the chunk buffer inprogress and ready fields into a single state
field. This is NOT just an aesthetic change, it fixes a once-in-a-blue- moon race (that happened just yesterday) where the disk write thread cleared ready and then inprogress as two seperate assignments and got context switched after the first. The result was that the net thread saw a chunk that was inprogress even though all blocks had been received and it issued a zero-block request. This triggered an assert in the server. Note that if we were prissy we would protect chunk buffer accesses with a mutex, but that is overkill for this single piece of shared state that can be protected via the "reasonable" atomicity of a write instruction.
Showing with 17 additions and 20 deletions