(_ *frameCache, fh FrameHeader, countError func(string), p []byte)
| 1008 | } |
| 1009 | |
| 1010 | func parseWindowUpdateFrame(_ *frameCache, fh FrameHeader, countError func(string), p []byte) (Frame, error) { |
| 1011 | if len(p) != 4 { |
| 1012 | countError("frame_windowupdate_bad_len") |
| 1013 | return nil, ConnectionError(ErrCodeFrameSize) |
| 1014 | } |
| 1015 | inc := binary.BigEndian.Uint32(p[:4]) & 0x7fffffff // mask off high reserved bit |
| 1016 | if inc == 0 { |
| 1017 | // A receiver MUST treat the receipt of a |
| 1018 | // WINDOW_UPDATE frame with an flow control window |
| 1019 | // increment of 0 as a stream error (Section 5.4.2) of |
| 1020 | // type PROTOCOL_ERROR; errors on the connection flow |
| 1021 | // control window MUST be treated as a connection |
| 1022 | // error (Section 5.4.1). |
| 1023 | if fh.StreamID == 0 { |
| 1024 | countError("frame_windowupdate_zero_inc_conn") |
| 1025 | return nil, ConnectionError(ErrCodeProtocol) |
| 1026 | } |
| 1027 | countError("frame_windowupdate_zero_inc_stream") |
| 1028 | return nil, streamError(fh.StreamID, ErrCodeProtocol) |
| 1029 | } |
| 1030 | return &WindowUpdateFrame{ |
| 1031 | FrameHeader: fh, |
| 1032 | Increment: inc, |
| 1033 | }, nil |
| 1034 | } |
| 1035 | |
| 1036 | // WriteWindowUpdate writes a WINDOW_UPDATE frame. |
| 1037 | // The increment value must be between 1 and 2,147,483,647, inclusive. |
nothing calls this directly
no test coverage detected
searching dependent graphs…