Skip to content

Commit 5580958

Browse files
committed
[FAB-2850] Update the conditional process
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 <[email protected]>
1 parent 01cc491 commit 5580958

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

core/chaincode/shim/chaincode.go

+7-9
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,13 @@ func chatWithPeer(chaincodename string, stream PeerChaincodeStream, cc Chaincode
262262
}
263263

264264
//keepalive messages are PONGs to the fabric's PINGs
265-
if (nsInfo != nil && nsInfo.sendToCC) || (in.Type == pb.ChaincodeMessage_KEEPALIVE) {
266-
if in.Type == pb.ChaincodeMessage_KEEPALIVE {
267-
chaincodeLogger.Debug("Sending KEEPALIVE response")
268-
//ignore any errors, maybe next KEEPALIVE will work
269-
handler.serialSendAsync(in, nil)
270-
} else {
271-
chaincodeLogger.Debugf("[%s]send state message %s", shorttxid(in.Txid), in.Type.String())
272-
handler.serialSendAsync(in, errc)
273-
}
265+
if in.Type == pb.ChaincodeMessage_KEEPALIVE {
266+
chaincodeLogger.Debug("Sending KEEPALIVE response")
267+
//ignore any errors, maybe next KEEPALIVE will work
268+
handler.serialSendAsync(in, nil)
269+
} else if nsInfo != nil && nsInfo.sendToCC {
270+
chaincodeLogger.Debugf("[%s]send state message %s", shorttxid(in.Txid), in.Type.String())
271+
handler.serialSendAsync(in, errc)
274272
}
275273
}
276274
}()

0 commit comments

Comments
 (0)