net: websocket: Refactor because of timeout overhaul

Mention in websocket API documentation that the timeout value
is in milliseconds. Check timeout values properly using K_TIMEOUT_EQ()
macro.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2020-04-03 09:43:39 +03:00
commit 5cf75fe091
5 changed files with 32 additions and 23 deletions

View file

@ -117,8 +117,8 @@ struct websocket_request {
* packets to the Websocket server.
* @param req Websocket request. User should allocate and fill the request
* data.
* @param timeout Max timeout to wait for the connection. The timeout value
* cannot be 0 as there would be no time to receive the data.
* @param timeout Max timeout to wait for the connection. The timeout value is
* in milliseconds. Value NET_WAIT_FOREVER means to wait forever.
* @param user_data User specified data that is passed to the callback.
*
* @return Websocket id to be used when sending/receiving Websocket data.
@ -142,7 +142,8 @@ int websocket_connect(int http_sock, struct websocket_request *req,
* must have opcode WEBSOCKET_OPCODE_CONTINUE. If final == true and this
* is the only message, then opcode should have proper opcode (text or
* binary) set.
* @param timeout How long to try to send the message.
* @param timeout How long to try to send the message. The value is in
* milliseconds. Value NET_WAIT_FOREVER means to wait forever.
*
* @return <0 if error, >=0 amount of bytes sent
*/
@ -162,6 +163,8 @@ int websocket_send_msg(int ws_sock, const u8_t *payload, size_t payload_len,
* @param message_type Type of the message.
* @param remaining How much there is data left in the message after this read.
* @param timeout How long to try to receive the message.
* The value is in milliseconds. Value NET_WAIT_FOREVER means to wait
* forever.
*
* @return <0 if error, >=0 amount of bytes received
*/