(h *headerFrame)
| 681 | } |
| 682 | |
| 683 | func (l *loopyWriter) headerHandler(h *headerFrame) error { |
| 684 | if l.side == serverSide { |
| 685 | str, ok := l.estdStreams[h.streamID] |
| 686 | if !ok { |
| 687 | if l.logger.V(logLevel) { |
| 688 | l.logger.Infof("Unrecognized streamID %d in loopyWriter", h.streamID) |
| 689 | } |
| 690 | return nil |
| 691 | } |
| 692 | // Case 1.A: Server is responding back with headers. |
| 693 | if !h.endStream { |
| 694 | return l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite) |
| 695 | } |
| 696 | // else: Case 1.B: Server wants to close stream. |
| 697 | |
| 698 | if str.state != empty { // either active or waiting on stream quota. |
| 699 | // add it str's list of items. |
| 700 | str.itl.enqueue(h) |
| 701 | return nil |
| 702 | } |
| 703 | if err := l.writeHeader(h.streamID, h.endStream, h.hf, h.onWrite); err != nil { |
| 704 | return err |
| 705 | } |
| 706 | return l.cleanupStreamHandler(h.cleanup) |
| 707 | } |
| 708 | // Case 2: Client wants to originate stream. |
| 709 | str := &outStream{ |
| 710 | id: h.streamID, |
| 711 | state: empty, |
| 712 | itl: &itemList{}, |
| 713 | wq: h.wq, |
| 714 | } |
| 715 | return l.originateStream(str, h) |
| 716 | } |
| 717 | |
| 718 | func (l *loopyWriter) originateStream(str *outStream, hdr *headerFrame) error { |
| 719 | // l.draining is set when handling GoAway. In which case, we want to avoid |
no test coverage detected