dtlsconnection: Replace if-else chain with switch

A more idiomatic construct for testing a bunch of integers.
This commit is contained in:
Jan Alexander Steffens (heftig) 2018-11-05 12:37:21 +01:00 committed by Sebastian Dröge
parent 49cc7b8091
commit 7bb6ce352b

View file

@ -721,23 +721,24 @@ openssl_poll (GstDtlsConnection * self)
log_state (self, "poll: after handshake"); log_state (self, "poll: after handshake");
if (ret == 1) { switch (ret) {
if (!self->priv->keys_exported) { case 1:
GST_INFO_OBJECT (self, if (!self->priv->keys_exported) {
"handshake just completed successfully, exporting keys"); GST_INFO_OBJECT (self,
export_srtp_keys (self); "handshake just completed successfully, exporting keys");
} else { export_srtp_keys (self);
GST_INFO_OBJECT (self, "handshake is completed"); } else {
} GST_INFO_OBJECT (self, "handshake is completed");
return; }
} else { return;
if (ret == 0) { case 0:
GST_DEBUG_OBJECT (self, "do_handshake encountered EOF"); GST_DEBUG_OBJECT (self, "do_handshake encountered EOF");
} else if (ret == -1) { break;
case -1:
GST_DEBUG_OBJECT (self, "do_handshake encountered BIO error"); GST_DEBUG_OBJECT (self, "do_handshake encountered BIO error");
} else { break;
default:
GST_DEBUG_OBJECT (self, "do_handshake returned %d", ret); GST_DEBUG_OBJECT (self, "do_handshake returned %d", ret);
}
} }
error = SSL_get_error (self->priv->ssl, ret); error = SSL_get_error (self->priv->ssl, ret);