mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
websocket: Consider pending SSL data when waiting for socket input
When TLS is in use, checking the readiness of the underlying FD is insufficient for determining if there is data available to be read. So before polling the FD, check if there is any buffered data in the TLS layer and use that first. ASTERISK-28562 #close Reported by: Robert Sutton Change-Id: I95fcb3e2004700d5cf8e5ee04943f0115b15e10d
This commit is contained in:
@@ -337,6 +337,20 @@ AST_OPTIONAL_API(void, ast_websocket_unref, (struct ast_websocket *session), {re
|
||||
*/
|
||||
AST_OPTIONAL_API(int, ast_websocket_fd, (struct ast_websocket *session), { errno = ENOSYS; return -1;});
|
||||
|
||||
/*!
|
||||
* \brief Wait for the WebSocket session to be ready to be read.
|
||||
* \since 16.8.0
|
||||
* \since 17.2.0
|
||||
*
|
||||
* \param session Pointer to the WebSocket session
|
||||
* \param timeout the number of milliseconds to wait
|
||||
*
|
||||
* \retval -1 if error occurred
|
||||
* \retval 0 if the timeout expired
|
||||
* \retval 1 if the WebSocket session is ready for reading
|
||||
*/
|
||||
AST_OPTIONAL_API(int, ast_websocket_wait_for_input, (struct ast_websocket *session, int timeout), { errno = ENOSYS; return -1; });
|
||||
|
||||
/*!
|
||||
* \brief Get the remote address for a WebSocket connected session.
|
||||
*
|
||||
|
||||
@@ -126,6 +126,20 @@ void ast_iostream_set_exclusive_input(struct ast_iostream *stream, int exclusive
|
||||
*/
|
||||
int ast_iostream_get_fd(struct ast_iostream *stream);
|
||||
|
||||
/*!
|
||||
* \brief Wait for input on the iostream's file descriptor
|
||||
* \since 16.8.0
|
||||
* \since 17.2.0
|
||||
*
|
||||
* \param stream A pointer to an iostream
|
||||
* \param timeout the number of milliseconds to wait
|
||||
*
|
||||
* \retval -1 if error occurred
|
||||
* \retval 0 if the timeout expired
|
||||
* \retval 1 if the stream is ready for reading
|
||||
*/
|
||||
int ast_iostream_wait_for_input(struct ast_iostream *stream, int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Make an iostream non-blocking.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user