remove unused code paths by steeling · Pull Request #4758 · openservicemesh/osm (original) (raw)

@steeling Could you explain in a bit more detail why these code paths are unreachable? That's not immediately obvious to me.

Sure thing!

The changed method is in getRootCert, which is only called in getSDSSecrets, and only in the case where the type is RootCert for inbound or outbound.

Now getServiceIdentitiesFromCert is only called in getRootCert, but it occurs after line154, which returns early if it is an Inbound cert, leaving only the case for outbound.

Yet getServiceIdentitiesFromCert, has a case for Inbound, which is unreachable.

After removing that case, the function is brought down to a few lines, and is better placed directly within getRootCert