mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-15 07:06:11 -04:00
Previously reading from an empty, closed Pipe returned: * IO exception if there were no writes to the pipe, * Empty byte array if there were writes to the pipe. With this change, we return an empty byte array on both paths. This also fixes a subtle race condition in the following flow: 1. Pipe is empty 2. Thread A is reading from the pipe (blocking call). 3. Thread B writes to the pipe and immediately closes it. 4. Thread A is unblocked and returns IO error. The data written by thread B is ignored! The new test in bluetooth_classic_test triggered that defect consistently. PiperOrigin-RevId: 518107700