Skip to content

Commit

Permalink
[FAB-14770] remove special path for keepalive error
Browse files Browse the repository at this point in the history
Change-Id: I6271a4c103eefd7bdcbb4e422a35cfff5c684a56
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Mar 27, 2019
1 parent bd20aa9 commit e0144ab
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions core/chaincode/shim/handler.go
Expand Up @@ -64,22 +64,17 @@ func (h *Handler) serialSend(msg *pb.ChaincodeMessage) error {
h.serialLock.Lock()
defer h.serialLock.Unlock()

err := h.chatStream.Send(msg)

return err
return h.chatStream.Send(msg)
}

//serialSendAsync serves the same purpose as serialSend (serialize msgs so gRPC will
//be happy). In addition, it is also asynchronous so send-remoterecv--localrecv loop
//can be nonblocking. Only errors need to be handled and these are handled by
//communication on supplied error channel. A typical use will be a non-blocking or
//nil channel
func (h *Handler) serialSendAsync(msg *pb.ChaincodeMessage, errc chan error) {
func (h *Handler) serialSendAsync(msg *pb.ChaincodeMessage, errc chan<- error) {
go func() {
err := h.serialSend(msg)
if errc != nil {
errc <- err
}
errc <- h.serialSend(msg)
}()
}

Expand Down Expand Up @@ -822,7 +817,7 @@ func (h *Handler) handleCreated(msg *pb.ChaincodeMessage, errc chan error) error
func (h *Handler) handleMessage(msg *pb.ChaincodeMessage, errc chan error) error {
if msg.Type == pb.ChaincodeMessage_KEEPALIVE {
chaincodeLogger.Debug("Sending KEEPALIVE response")
h.serialSendAsync(msg, nil) // ignore errors, maybe next KEEPALIVE will work
h.serialSendAsync(msg, errc)
return nil
}
chaincodeLogger.Debugf("[%s] Handling ChaincodeMessage of type: %s(state:%s)", shorttxid(msg.Txid), msg.Type, h.state)
Expand Down

0 comments on commit e0144ab

Please sign in to comment.