__guac_fill_instructionbuf() should report errors.

This commit is contained in:
Michael Jumper 2012-03-15 11:30:52 -07:00
parent eb73b52e69
commit 1aa594bd8b

View File

@ -186,15 +186,22 @@ int __guac_fill_instructionbuf(guac_socket* socket) {
0 0
); );
if (retval < 0) /* Set guac_error if recv() unsuccessful */
if (retval < 0) {
guac_error = GUAC_STATUS_SEE_ERRNO;
guac_error_message = "Error filling instruction buffer";
return retval; return retval;
}
socket->__instructionbuf_used_length += retval; socket->__instructionbuf_used_length += retval;
/* Expand buffer if necessary */ /* Expand buffer if necessary */
if (socket->__instructionbuf_used_length > socket->__instructionbuf_size / 2) { if (socket->__instructionbuf_used_length >
socket->__instructionbuf_size / 2) {
socket->__instructionbuf_size *= 2; socket->__instructionbuf_size *= 2;
socket->__instructionbuf = realloc(socket->__instructionbuf, socket->__instructionbuf_size); socket->__instructionbuf = realloc(socket->__instructionbuf,
socket->__instructionbuf_size);
} }
return retval; return retval;
@ -203,7 +210,8 @@ int __guac_fill_instructionbuf(guac_socket* socket) {
/* Returns new instruction if one exists, or NULL if no more instructions. */ /* Returns new instruction if one exists, or NULL if no more instructions. */
guac_instruction* guac_protocol_read_instruction(guac_socket* socket, int usec_timeout) { guac_instruction* guac_protocol_read_instruction(guac_socket* socket,
int usec_timeout) {
int retval; int retval;