Skip to content

Commit

Permalink
[FAB-5884] Refine the Handler module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yeasy committed Aug 23, 2017
1 parent 1f591ab commit 3765fb5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions core/chaincode/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ const (

var chaincodeLogger = flogging.MustGetLogger("chaincode")

// MessageHandler interface for handling chaincode messages (common between Peer chaincode support and chaincode)
type MessageHandler interface {
HandleMessage(msg *pb.ChaincodeMessage) error
SendMessage(msg *pb.ChaincodeMessage) error
}

type transactionContext struct {
chainID string
signedProp *pb.SignedProposal
Expand Down Expand Up @@ -367,7 +361,7 @@ func (handler *Handler) processStream() error {
continue
}

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

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

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

0 comments on commit 3765fb5

Please sign in to comment.