diff options
author | Jan Alexander Steffens (heftig) <jsteffens@make.tv> | 2018-11-05 12:37:21 +0100 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2018-11-06 16:23:50 +0000 |
commit | 7bb6ce352b8015cd6855ab5dda16e4cba3318a15 (patch) | |
tree | 5931f82b5d4cf988b312e2a3d76e82a13a54db16 /ext/dtls/gstdtlsconnection.c | |
parent | 49cc7b809114dff4ceb108b530d4c4592a1b03b9 (diff) | |
download | gstreamer-plugins-bad-7bb6ce352b8015cd6855ab5dda16e4cba3318a15.tar.gz |
dtlsconnection: Replace if-else chain with switch
A more idiomatic construct for testing a bunch of integers.
Diffstat (limited to 'ext/dtls/gstdtlsconnection.c')
-rw-r--r-- | ext/dtls/gstdtlsconnection.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/ext/dtls/gstdtlsconnection.c b/ext/dtls/gstdtlsconnection.c index 0242aebc5..a6db163af 100644 --- a/ext/dtls/gstdtlsconnection.c +++ b/ext/dtls/gstdtlsconnection.c @@ -721,23 +721,24 @@ openssl_poll (GstDtlsConnection * self) log_state (self, "poll: after handshake"); - if (ret == 1) { - if (!self->priv->keys_exported) { - GST_INFO_OBJECT (self, - "handshake just completed successfully, exporting keys"); - export_srtp_keys (self); - } else { - GST_INFO_OBJECT (self, "handshake is completed"); - } - return; - } else { - if (ret == 0) { + switch (ret) { + case 1: + if (!self->priv->keys_exported) { + GST_INFO_OBJECT (self, + "handshake just completed successfully, exporting keys"); + export_srtp_keys (self); + } else { + GST_INFO_OBJECT (self, "handshake is completed"); + } + return; + case 0: GST_DEBUG_OBJECT (self, "do_handshake encountered EOF"); - } else if (ret == -1) { + break; + case -1: GST_DEBUG_OBJECT (self, "do_handshake encountered BIO error"); - } else { + break; + default: GST_DEBUG_OBJECT (self, "do_handshake returned %d", ret); - } } error = SSL_get_error (self->priv->ssl, ret); |