@@ -28,7 +28,7 @@ func (s *Stream) Close() error {
2828 s .wer .Put (io .ErrClosedPipe )
2929 s .zo0 .Do (func () {
3030 s .mux .pri .Pri (0 , func () error {
31- s .mux .con .Write ([]byte {s .idx , 0x02 , 0x00 , 0x00 })
31+ s .mux .con .Write ([]byte {0x02 , s .idx , 0x00 , 0x00 })
3232 return nil
3333 })
3434 })
@@ -41,7 +41,7 @@ func (s *Stream) Esolc() error {
4141 s .wer .Put (io .ErrClosedPipe )
4242 s .zo0 .Do (func () {
4343 s .mux .pri .Pri (0 , func () error {
44- s .mux .con .Write ([]byte {s .idx , 0x02 , 0x01 , 0x00 })
44+ s .mux .con .Write ([]byte {0x02 , s .idx , 0x01 , 0x00 })
4545 return nil
4646 })
4747 })
@@ -98,8 +98,8 @@ func (s *Stream) Write(p []byte) (int, error) {
9898 case len (p ) >= 0 :
9999 return n , nil
100100 }
101- buf [0 ] = s . idx
102- buf [1 ] = 0x01
101+ buf [0 ] = 0x01
102+ buf [1 ] = s . idx
103103 binary .BigEndian .PutUint16 (buf [2 :4 ], uint16 (l ))
104104 copy (buf [4 :], p [:l ])
105105 p = p [l :]
@@ -177,7 +177,7 @@ func (m *Mux) Open() (*Stream, error) {
177177 return nil , err
178178 }
179179 err = m .pri .Pri (0 , func () error {
180- return doa .Err (m .con .Write ([]byte {idx , 0x00 , 0x00 , 0x00 }))
180+ return doa .Err (m .con .Write ([]byte {0x00 , idx , 0x00 , 0x00 }))
181181 })
182182 if err != nil {
183183 m .idp .Put (idx )
@@ -200,7 +200,7 @@ func (m *Mux) Recv() {
200200 old * Stream
201201 prb = time .AfterFunc (Conf .IdleProbeDuration , func () {
202202 if m .pri .Pri (0 , func () error {
203- return doa .Err (m .con .Write ([]byte {0x00 , 0x03 , 0x00 , 0x00 }))
203+ return doa .Err (m .con .Write ([]byte {0x03 , 0x00 , 0x00 , 0x00 }))
204204 }) != nil {
205205 m .Close ()
206206 }
@@ -218,8 +218,8 @@ func (m *Mux) Recv() {
218218 m .rer .Put (err )
219219 break
220220 }
221- idx = buf [0 ]
222- cmd = buf [1 ]
221+ cmd = buf [0 ]
222+ idx = buf [1 ]
223223 switch {
224224 case cmd == 0x00 :
225225 // Make sure the stream has been closed properly.
@@ -257,7 +257,7 @@ func (m *Mux) Recv() {
257257 switch buf [2 ] {
258258 case 0x00 :
259259 m .pri .Pri (0 , func () error {
260- return doa .Err (m .con .Write ([]byte {0x00 , 0x03 , 0x01 , 0x00 }))
260+ return doa .Err (m .con .Write ([]byte {0x03 , 0x00 , 0x01 , 0x00 }))
261261 })
262262 case 0x01 :
263263 }
0 commit comments