@@ -93,12 +93,12 @@ func (h *Handler) createChannel(channelID, txid string) (<-chan pb.ChaincodeMess
93
93
return nil , errors .Errorf ("[%s] channel exists" , shorttxid (txCtxID ))
94
94
}
95
95
96
- c := make (chan pb.ChaincodeMessage )
97
- h .responseChannels [txCtxID ] = c
98
- return c , nil
96
+ responseChan := make (chan pb.ChaincodeMessage )
97
+ h .responseChannels [txCtxID ] = responseChan
98
+ return responseChan , nil
99
99
}
100
100
101
- func (h * Handler ) sendChannel (msg * pb.ChaincodeMessage ) error {
101
+ func (h * Handler ) handleResponse (msg * pb.ChaincodeMessage ) error {
102
102
h .responseChannelsMutex .Lock ()
103
103
defer h .responseChannelsMutex .Unlock ()
104
104
@@ -109,7 +109,7 @@ func (h *Handler) sendChannel(msg *pb.ChaincodeMessage) error {
109
109
txCtxID := h .getTxCtxId (msg .ChannelId , msg .Txid )
110
110
responseCh := h .responseChannels [txCtxID ]
111
111
if responseCh == nil {
112
- return errors .Errorf ("[%s] sendChannel does not exist" , shorttxid (msg .Txid ))
112
+ return errors .Errorf ("[%s] responseChannel does not exist" , shorttxid (msg .Txid ))
113
113
}
114
114
115
115
chaincodeLogger .Debugf ("[%s] before send" , shorttxid (msg .Txid ))
@@ -120,7 +120,7 @@ func (h *Handler) sendChannel(msg *pb.ChaincodeMessage) error {
120
120
}
121
121
122
122
//sends a message and selects
123
- func (h * Handler ) sendReceive (msg * pb.ChaincodeMessage , c <- chan pb.ChaincodeMessage ) (pb.ChaincodeMessage , error ) {
123
+ func (h * Handler ) sendReceive (msg * pb.ChaincodeMessage , responseChan <- chan pb.ChaincodeMessage ) (pb.ChaincodeMessage , error ) {
124
124
errc := make (chan error , 1 )
125
125
h .serialSendAsync (msg , errc )
126
126
@@ -136,7 +136,7 @@ func (h *Handler) sendReceive(msg *pb.ChaincodeMessage, c <-chan pb.ChaincodeMes
136
136
if err != nil {
137
137
return pb.ChaincodeMessage {}, err
138
138
}
139
- case outmsg , val := <- c :
139
+ case outmsg , val := <- responseChan :
140
140
if ! val {
141
141
return pb.ChaincodeMessage {}, errors .New ("unexpected failure on receive" )
142
142
}
@@ -749,7 +749,7 @@ func (h *Handler) handleInvokeChaincode(chaincodeName string, args [][]byte, cha
749
749
func (h * Handler ) handleReady (msg * pb.ChaincodeMessage , errc chan error ) error {
750
750
switch msg .Type {
751
751
case pb .ChaincodeMessage_RESPONSE , pb .ChaincodeMessage_ERROR :
752
- if err := h .sendChannel (msg ); err != nil {
752
+ if err := h .handleResponse (msg ); err != nil {
753
753
chaincodeLogger .Errorf ("[%s] error sending %s (state:%s): %s" , shorttxid (msg .Txid ), msg .Type , h .state , err )
754
754
return err
755
755
}
0 commit comments