Skip to content

Commit

Permalink
fix an offset issue in OTA
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Jul 13, 2016
1 parent d602025 commit fc69c77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion proxy/shadowsocks/ota.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (this *ChunkReader) Read() (*alloc.Buffer, error) {
log.Debug("AuthenticationReader: Unexpected auth: ", authBytes)
return nil, transport.ErrCorruptedPacket
}
buffer.Value = payload
buffer.SliceFrom(AuthSize)

return buffer, nil
}
3 changes: 3 additions & 0 deletions proxy/shadowsocks/ota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ func TestNormalChunkReading(t *testing.T) {
payload, err := reader.Read()
assert.Error(err).IsNil()
assert.Bytes(payload.Value).Equals([]byte{11, 12, 13, 14, 15, 16, 17, 18})

payload.PrependBytes(3, 4)
assert.Bytes(payload.Value).Equals([]byte{3, 4, 11, 12, 13, 14, 15, 16, 17, 18})
}

0 comments on commit fc69c77

Please sign in to comment.