mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
dtlsconnection: Print out errno info for syscall errors
As suggested in [the SSL_get_error manpage][1]. Upgrade the message to a warning if the errno isn't 0 (success). The latter apparently means the transport encountered an EOF (shutdown) without the shut down handshake on the (D)TLS level. This happens quite often for otherwise normal DTLS connections. [1]: https://www.openssl.org/docs/man1.1.1/man3/SSL_get_error.html
This commit is contained in:
parent
51f0307900
commit
b1509b1047
1 changed files with 18 additions and 1 deletions
|
@ -42,7 +42,12 @@
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#include <winsock2.h>
|
||||||
|
#else
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug);
|
||||||
#define GST_CAT_DEFAULT gst_dtls_connection_debug
|
#define GST_CAT_DEFAULT gst_dtls_connection_debug
|
||||||
|
@ -773,7 +778,19 @@ openssl_poll (GstDtlsConnection * self)
|
||||||
GST_LOG_OBJECT (self, "SSL wants write");
|
GST_LOG_OBJECT (self, "SSL wants write");
|
||||||
break;
|
break;
|
||||||
case SSL_ERROR_SYSCALL:{
|
case SSL_ERROR_SYSCALL:{
|
||||||
GST_LOG_OBJECT (self, "SSL syscall error");
|
gchar message[1024] = "<unknown>";
|
||||||
|
gint syserror;
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
syserror = WSAGetLastError ();
|
||||||
|
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, syserror, 0, message,
|
||||||
|
sizeof message, NULL);
|
||||||
|
#else
|
||||||
|
syserror = errno;
|
||||||
|
strerror_r (syserror, message, sizeof message);
|
||||||
|
#endif
|
||||||
|
GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT,
|
||||||
|
syserror != 0 ? GST_LEVEL_WARNING : GST_LEVEL_LOG,
|
||||||
|
self, "SSL syscall error: errno %d: %s", syserror, message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue