When data is read from socket, it is buffered. There might be multiple messages buffered at once.
Even in such case TcpSock::read() should try to decrypt a single message whose length is known
by the header. Unfortunately, that was not the case: read() attempted to decrypt a whole buffer
and would fail utterly.
This fix makes sure we respect the message boundaries before trying to decrypt it.
When data is read from socket, it is buffered. There might be multiple messages buffered at once. Even in such case TcpSock::read() should try to decrypt a single message whose length is known by the header. Unfortunately, that was not the case: read() attempted to decrypt a whole buffer and would fail utterly.
This fix makes sure we respect the message boundaries before trying to decrypt it.