Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
None
Description
/* returns:
- -1 if recv call failed,
- 0 if recv would block,
- 1 if success
*/
static int recv_buffer(zhandle_t *zh, buffer_list_t *buff)
{
int off = buff->curr_offset;
int rc = 0;
[................]
if (buff == &zh->primer_buffer && rc == buff->len - 1) ++rc; <====== Handshake prematurely complete.
On non-blocking socket, it's possible that socket has exactly "buff->len - 1" bytes to read.
Because of the above line, the Handshake is prematurely completed.
What this can lead to is:
There will be one outstanding byte left on the socket and it might go as part of next message which could get corrupted.
I think this can lead to ZRUNTIMEINCONSISTENCY issues later.
Attachments
Issue Links
- links to