Chromecast packet receive unreliable
There are a bunch of logical flaws in ChromecastCommunication::recvPacket:
- A packet can exists as unread data in the TLS protocol stack buffers, even if the underlying socket does not poll for input. This can lead to spurious time-outs.
- The "packet too long" error message claims to drop messages. But it seems it really drops the connection. Either the message is wrong, or the code probably is.
- The code incorrectly assumes that a packet is either complete or absent. This leads to a dead lock if packet is partially received: poll() will wake up, but vlc_tls_Read() will get stuck.