@@ -12,7 +12,7 @@ import (
1212
1313// A Stream managed by the multiplexer.
1414type Stream struct {
15- fwd time.Time
15+ fwu time.Time
1616 idx uint8
1717 mux * Mux
1818 rbf []byte
@@ -91,9 +91,9 @@ func (s *Stream) Write(p []byte) (int, error) {
9191 )
9292 for {
9393 switch {
94- case len (p ) >= 2044 :
95- buf = make ([]byte , 2048 )
96- l = 2044
94+ case len (p ) >= Conf . PacketSize - 4 :
95+ buf = make ([]byte , Conf . PacketSize )
96+ l = Conf . PacketSize - 4
9797 case len (p ) >= 1 :
9898 buf = make ([]byte , 4 + len (p ))
9999 l = len (p )
@@ -105,7 +105,7 @@ func (s *Stream) Write(p []byte) (int, error) {
105105 binary .BigEndian .PutUint16 (buf [2 :4 ], uint16 (l ))
106106 copy (buf [4 :], p [:l ])
107107 p = p [l :]
108- if time .Now ().After (s .fwd ) {
108+ if time .Now ().After (s .fwu ) {
109109 z = 2
110110 }
111111 err := s .mux .pri .Pri (z , func () error {
@@ -129,7 +129,7 @@ func (s *Stream) Write(p []byte) (int, error) {
129129// NewStream returns a new Stream.
130130func NewStream (idx uint8 , mux * Mux ) * Stream {
131131 return & Stream {
132- fwd : time .Now ().Add (Conf .FastWriteDuration ),
132+ fwu : time .Now ().Add (Conf .FastWriteDuration ),
133133 idx : idx ,
134134 mux : mux ,
135135 rbf : make ([]byte , 0 ),
0 commit comments