File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -125,22 +125,22 @@ type WriteCounter struct {
125125 connection * net.Conn
126126 expectedLength uint64
127127}
128- func reverseBytes (input []byte ) []byte {
129- if len (input ) == 0 {
130- return input
131- }
132- return append (reverseBytes (input [1 :]), input [0 ])
133- }
128+ // func reverseBytes(input []byte) []byte {
129+ // if len(input) == 0 {
130+ // return input
131+ // }
132+ // return append(reverseBytes(input[1:]), input[0])
133+ // }
134134func (wc * WriteCounter ) Write (p []byte ) (int , error ) {
135135 n := len (p )
136136 wc .Total += uint64 (n )
137- buf := bytes .NewBuffer ([]byte {} )
137+ buf := bytes .NewBuffer (make ( []byte , 8 ) )
138138
139139 if wc .expectedLength > 0xffffffff {
140140 binary .Write ((* wc .connection ), binary .BigEndian , buf .Bytes ())
141141
142142 }else {
143- binary .Write (buf , binary .LittleEndian , reverseBytes ( buf .Bytes ())[ 0 : 4 ])
143+ binary .Write (buf , binary .BigEndian , buf .Bytes ()[ 4 : 8 ])
144144
145145 }
146146
You can’t perform that action at this time.
0 commit comments