StreamID calculates the stream ID.
(stype StreamType, pers Perspective)
| 66 | |
| 67 | // StreamID calculates the stream ID. |
| 68 | func (s StreamNum) StreamID(stype StreamType, pers Perspective) quic.StreamID { |
| 69 | if s == 0 { |
| 70 | return InvalidStreamID |
| 71 | } |
| 72 | var first quic.StreamID |
| 73 | switch stype { |
| 74 | case StreamTypeBidi: |
| 75 | switch pers { |
| 76 | case PerspectiveClient: |
| 77 | first = 0 |
| 78 | case PerspectiveServer: |
| 79 | first = 1 |
| 80 | } |
| 81 | case StreamTypeUni: |
| 82 | switch pers { |
| 83 | case PerspectiveClient: |
| 84 | first = 2 |
| 85 | case PerspectiveServer: |
| 86 | first = 3 |
| 87 | } |
| 88 | } |
| 89 | return first + 4*quic.StreamID(s-1) |
| 90 | } |