Commit 42420364 authored by yacovm's avatar yacovm
Browse files

[FAB-14682] Add stream ID to err msg



This change set:

- Adds the steam ID to the aborted error message for better
  readability and troubleshooting.
- Reverses the order between:
  - The log message that says that the stream was terminated.
  - The actual termination of the stream.

Change-Id: If3537b4770eb00d5c67b032bdb49303c9007e794
Signed-off-by: default avataryacovm <yacovm@il.ibm.com>
parent bd0358d4
......@@ -491,7 +491,7 @@ func (stream *Stream) sendOrDrop(request *orderer.StepRequest, allowDrop bool) e
select {
case <-stream.abortChan:
return errors.New("stream aborted")
return errors.Errorf("stream %d aborted", stream.ID)
case stream.sendBuff <- request:
return nil
case <-stream.commShutdown:
......@@ -586,11 +586,11 @@ func (stream *Stream) operateWithTimeout(invoke StreamOperation) (*orderer.StepR
}
return r.res, r.err
case <-timer.C:
stream.Logger.Warningf("Stream %d to %s(%s) was forcibly terminated because timeout (%v) expired",
stream.ID, stream.NodeName, stream.Endpoint, stream.Timeout)
stream.Cancel(errTimeout)
// Wait for the operation goroutine to end
operationEnded.Wait()
stream.Logger.Warningf("Stream %d to %s(%s) was forcibly terminated because timeout (%v) expired",
stream.ID, stream.NodeName, stream.Endpoint, stream.Timeout)
return nil, errTimeout
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment