Skip to content

Commit

Permalink
[FAB-13805] Unify Step and Submit into a stream
Browse files Browse the repository at this point in the history
This change set removes Step RPC from the cluster protobuf,
and renames Submit stream to a Step stream, and makes both
transaction forwarding and consensus messages use the
new Step stream.

It also makes both egress Send() and Recv(), have a maximum
timeout (the RPC timeout in the config).
A Send or Recv that is used to send a consensus message,
or send (receive) a transaction (status) will now abort prematurely
in order to protect against any liveness issue on the remote node,
and also to return an answer to clients within a timely manner.

Change-Id: Id942b248212f5c324e12af34fce48f96fdbb6aea
Signed-off-by: yacovm <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Jan 29, 2019
1 parent a90376f commit 15e6707
Show file tree
Hide file tree
Showing 28 changed files with 1,228 additions and 853 deletions.
16 changes: 13 additions & 3 deletions core/comm/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func noopBinding(_ context.Context, _ []byte) error {
// ExtractCertificateHashFromContext extracts the hash of the certificate from the given context.
// If the certificate isn't present, nil is returned
func ExtractCertificateHashFromContext(ctx context.Context) []byte {
rawCert := ExtractCertificateFromContext(ctx)
rawCert := ExtractRawCertificateFromContext(ctx)
if len(rawCert) == 0 {
return nil
}
Expand All @@ -126,7 +126,7 @@ func ExtractCertificateHashFromContext(ctx context.Context) []byte {

// ExtractCertificateFromContext returns the TLS certificate (if applicable)
// from the given context of a gRPC stream
func ExtractCertificateFromContext(ctx context.Context) []byte {
func ExtractCertificateFromContext(ctx context.Context) *x509.Certificate {
pr, extracted := peer.FromContext(ctx)
if !extracted {
return nil
Expand All @@ -145,5 +145,15 @@ func ExtractCertificateFromContext(ctx context.Context) []byte {
if len(certs) == 0 {
return nil
}
return certs[0].Raw
return certs[0]
}

// ExtractRawCertificateFromContext returns the raw TLS certificate (if applicable)
// from the given context of a gRPC stream
func ExtractRawCertificateFromContext(ctx context.Context) []byte {
cert := ExtractCertificateFromContext(ctx)
if cert == nil {
return nil
}
return cert.Raw
}
Loading

0 comments on commit 15e6707

Please sign in to comment.