You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Bump libwebsockets to version 2.4.2
This commit is contained in:
41
thirdparty/lws/mbedtls_wrapper/platform/ssl_pm.c
vendored
41
thirdparty/lws/mbedtls_wrapper/platform/ssl_pm.c
vendored
@@ -360,17 +360,52 @@ int ssl_pm_read(SSL *ssl, void *buffer, int len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* This returns -1, or the length sent.
|
||||
* If -1, then you need to find out if the error was
|
||||
* fatal or recoverable using SSL_get_error()
|
||||
*/
|
||||
int ssl_pm_send(SSL *ssl, const void *buffer, int len)
|
||||
{
|
||||
int ret;
|
||||
struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
|
||||
|
||||
ret = mbedtls_ssl_write(&ssl_pm->ssl, buffer, len);
|
||||
/*
|
||||
* We can get a positive number, which may be less than len... that
|
||||
* much was sent successfully and you can call again to send more.
|
||||
*
|
||||
* We can get a negative mbedtls error code... if WANT_WRITE or WANT_READ,
|
||||
* it's nonfatal and means it should be retried as-is. If something else,
|
||||
* it's fatal actually.
|
||||
*
|
||||
* If this function returns something other than a positive value or
|
||||
* MBEDTLS_ERR_SSL_WANT_READ/WRITE, the ssl context becomes unusable, and
|
||||
* you should either free it or call mbedtls_ssl_session_reset() on it
|
||||
* before re-using it for a new connection; the current connection must
|
||||
* be closed.
|
||||
*
|
||||
* When this function returns MBEDTLS_ERR_SSL_WANT_WRITE/READ, it must be
|
||||
* called later with the same arguments, until it returns a positive value.
|
||||
*/
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret == MBEDTLS_ERR_NET_CONN_RESET)
|
||||
SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_write() return -0x%x", -ret);
|
||||
switch (ret) {
|
||||
case MBEDTLS_ERR_NET_CONN_RESET:
|
||||
ssl->err = SSL_ERROR_SYSCALL;
|
||||
SSL_DEBUG(SSL_PLATFORM_ERROR_LEVEL, "mbedtls_ssl_write() return -0x%x", -ret);
|
||||
ret = -1;
|
||||
break;
|
||||
case MBEDTLS_ERR_SSL_WANT_WRITE:
|
||||
ssl->err = SSL_ERROR_WANT_WRITE;
|
||||
break;
|
||||
case MBEDTLS_ERR_SSL_WANT_READ:
|
||||
ssl->err = SSL_ERROR_WANT_READ;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user