processCompleteMessage assembles DATA frames for the given side and parses gRPC payload
(s *HTTP2StreamState, isOutgoing bool)
| 447 | |
| 448 | // processCompleteMessage assembles DATA frames for the given side and parses gRPC payload |
| 449 | func (sm *DefaultStreamManager) processCompleteMessage(s *HTTP2StreamState, isOutgoing bool) error { |
| 450 | if isOutgoing { |
| 451 | if s.grpcResp == nil { |
| 452 | s.grpcResp = &models.GrpcResp{} |
| 453 | } |
| 454 | if len(s.respDataFrames) == 0 { |
| 455 | // gRPC error responses have no DATA frame — body is empty. |
| 456 | // Leave grpcResp.Body as zero value so the stream is still marked complete. |
| 457 | return nil |
| 458 | } |
| 459 | data := bytes.Join(s.respDataFrames, nil) |
| 460 | s.respDataFrames = nil |
| 461 | s.grpcResp.Body = CreateLengthPrefixedMessageFromPayload(data) |
| 462 | return nil |
| 463 | |
| 464 | } else { |
| 465 | if len(s.reqDataFrames) == 0 { |
| 466 | return nil |
| 467 | } |
| 468 | data := bytes.Join(s.reqDataFrames, nil) |
| 469 | s.reqDataFrames = nil |
| 470 | |
| 471 | if s.grpcReq == nil { |
| 472 | s.grpcReq = &models.GrpcReq{} |
| 473 | } |
| 474 | s.grpcReq.Body = CreateLengthPrefixedMessageFromPayload(data) |
| 475 | return nil |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | // checkStreamCompletion decides when a stream is complete (request done + response done with trailers) |
| 480 | func (sm *DefaultStreamManager) checkStreamCompletion(streamID uint32) { |
no test coverage detected