Skip to content

Commit

Permalink
[FAB-2850] Update the conditional process
Browse files Browse the repository at this point in the history
Existing code is complex to follow the logic.

This is a quick fix for simplicity and easy to understand.

This fixes https://jira.hyperledger.org/browse/FAB-2850.

Change-Id: I36c80705731d10b8f7095b15936d5f99ebec7af6
Signed-off-by: Baohua Yang <baohyang@cn.ibm.com>
  • Loading branch information
yeasy committed Mar 24, 2017
1 parent 01cc491 commit 5580958
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions core/chaincode/shim/chaincode.go
Expand Up @@ -262,15 +262,13 @@ func chatWithPeer(chaincodename string, stream PeerChaincodeStream, cc Chaincode
}

//keepalive messages are PONGs to the fabric's PINGs
if (nsInfo != nil && nsInfo.sendToCC) || (in.Type == pb.ChaincodeMessage_KEEPALIVE) {
if in.Type == pb.ChaincodeMessage_KEEPALIVE {
chaincodeLogger.Debug("Sending KEEPALIVE response")
//ignore any errors, maybe next KEEPALIVE will work
handler.serialSendAsync(in, nil)
} else {
chaincodeLogger.Debugf("[%s]send state message %s", shorttxid(in.Txid), in.Type.String())
handler.serialSendAsync(in, errc)
}
if in.Type == pb.ChaincodeMessage_KEEPALIVE {
chaincodeLogger.Debug("Sending KEEPALIVE response")
//ignore any errors, maybe next KEEPALIVE will work
handler.serialSendAsync(in, nil)
} else if nsInfo != nil && nsInfo.sendToCC {
chaincodeLogger.Debugf("[%s]send state message %s", shorttxid(in.Txid), in.Type.String())
handler.serialSendAsync(in, errc)
}
}
}()
Expand Down

0 comments on commit 5580958

Please sign in to comment.