net: websockets: Fix websocket_send_msg return code
When the websocket_prepare_and_send is called from websocket_send_msg, the header length is subtracted to retrieve the transmitted payload length. Make an exclutsion to prevent the return code of websocket_prepare_and_send being modified in case of 0 or a negative return code. This avoid confusion with modificated error codes Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
This commit is contained in:
parent
53af1ba59e
commit
452592fc9a
|
@ -707,6 +707,11 @@ quit:
|
|||
k_free(data_to_send);
|
||||
}
|
||||
|
||||
/* Do no math with 0 and error codes */
|
||||
if (ret <= 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret - hdr_len;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue