diff options
author | Jan Alexander Steffens (heftig) <jsteffens@make.tv> | 2018-11-06 16:50:29 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-11-07 23:29:45 +0200 |
commit | 0dd79ed64cb254796c3533fc9e195c04c9bb2efc (patch) | |
tree | f8248f38311f4454cf85eae03b414a497d44971a | |
parent | 472976f21d960876a1dae85364a58af029b71b9d (diff) | |
download | gstreamer-plugins-bad-0dd79ed64cb254796c3533fc9e195c04c9bb2efc.tar.gz |
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
-rw-r--r-- | ext/dtls/gstdtlsconnection.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ext/dtls/gstdtlsconnection.c b/ext/dtls/gstdtlsconnection.c index 382dca215..baa6af5a7 100644 --- a/ext/dtls/gstdtlsconnection.c +++ b/ext/dtls/gstdtlsconnection.c @@ -42,7 +42,12 @@ #include <openssl/err.h> #include <openssl/ssl.h> +#ifdef G_OS_WIN32 +#include <winsock2.h> +#else #include <string.h> +#include <errno.h> +#endif GST_DEBUG_CATEGORY_STATIC (gst_dtls_connection_debug); #define GST_CAT_DEFAULT gst_dtls_connection_debug @@ -774,7 +779,19 @@ openssl_poll (GstDtlsConnection * self) GST_LOG_OBJECT (self, "SSL wants write"); break; 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; } default: |