Skip to content

Commit 3765fb5

Browse files
committed
[FAB-5884] Refine the Handler module
Remove orphan MessageHandler interface, as no usage. And change Handler's HandlerMessage() as private method as it was not called from outside. Change-Id: I2f1f615bfd4bdaaaadf7970dc0a5a7d99ecd1ca4 Signed-off-by: Baohua Yang <yangbaohua@gmail.com>
1 parent 1f591ab commit 3765fb5

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

core/chaincode/handler.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ const (
5151

5252
var chaincodeLogger = flogging.MustGetLogger("chaincode")
5353

54-
// MessageHandler interface for handling chaincode messages (common between Peer chaincode support and chaincode)
55-
type MessageHandler interface {
56-
HandleMessage(msg *pb.ChaincodeMessage) error
57-
SendMessage(msg *pb.ChaincodeMessage) error
58-
}
59-
6054
type transactionContext struct {
6155
chainID string
6256
signedProp *pb.SignedProposal
@@ -367,7 +361,7 @@ func (handler *Handler) processStream() error {
367361
continue
368362
}
369363

370-
err = handler.HandleMessage(in)
364+
err = handler.handleMessage(in)
371365
if err != nil {
372366
chaincodeLogger.Errorf("[%s]Error handling message, ending stream: %s", shorttxid(in.Txid), err)
373367
return fmt.Errorf("Error handling message, ending stream: %s", err)
@@ -1384,8 +1378,8 @@ func (handler *Handler) ready(ctxt context.Context, chainID string, txid string,
13841378
return txctx.responseNotifier, nil
13851379
}
13861380

1387-
// HandleMessage implementation of MessageHandler interface. Peer's handling of Chaincode messages.
1388-
func (handler *Handler) HandleMessage(msg *pb.ChaincodeMessage) error {
1381+
// handleMessage is the entrance method for Peer's handling of Chaincode messages.
1382+
func (handler *Handler) handleMessage(msg *pb.ChaincodeMessage) error {
13891383
chaincodeLogger.Debugf("[%s]Fabric side Handling ChaincodeMessage of type: %s in state %s", shorttxid(msg.Txid), msg.Type, handler.FSM.Current())
13901384

13911385
if (msg.Type == pb.ChaincodeMessage_COMPLETED || msg.Type == pb.ChaincodeMessage_ERROR) && handler.FSM.Current() == "ready" {

0 commit comments

Comments
 (0)