Bump max file size and count

This commit is contained in:
Jakob Borg 2014-07-05 11:05:45 +02:00
parent 3d7d4d845a
commit 2d272a3cac
3 changed files with 8 additions and 8 deletions

View File

@ -597,9 +597,9 @@ restrictive than the following:
### Index and Index Update Messages
- Repository: 64 bytes
- Number of Files: 1.000.000
- Number of Files: 10.000.000
- Name: 1024 bytes
- Number of Blocks: 100.000
- Number of Blocks: 1.000.000
- Hash: 64 bytes
### Request Messages

View File

@ -6,7 +6,7 @@ package protocol
type IndexMessage struct {
Repository string // max:64
Files []FileInfo // max:1000000
Files []FileInfo // max:10000000
}
type FileInfo struct {
@ -14,7 +14,7 @@ type FileInfo struct {
Flags uint32
Modified int64
Version uint64
Blocks []BlockInfo // max:100000
Blocks []BlockInfo // max:1000000
}
type BlockInfo struct {

View File

@ -24,7 +24,7 @@ func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
return xw.Tot(), xdr.ErrElementSizeExceeded
}
xw.WriteString(o.Repository)
if len(o.Files) > 1000000 {
if len(o.Files) > 10000000 {
return xw.Tot(), xdr.ErrElementSizeExceeded
}
xw.WriteUint32(uint32(len(o.Files)))
@ -48,7 +48,7 @@ func (o *IndexMessage) UnmarshalXDR(bs []byte) error {
func (o *IndexMessage) decodeXDR(xr *xdr.Reader) error {
o.Repository = xr.ReadStringMax(64)
_FilesSize := int(xr.ReadUint32())
if _FilesSize > 1000000 {
if _FilesSize > 10000000 {
return xdr.ErrElementSizeExceeded
}
o.Files = make([]FileInfo, _FilesSize)
@ -78,7 +78,7 @@ func (o FileInfo) encodeXDR(xw *xdr.Writer) (int, error) {
xw.WriteUint32(o.Flags)
xw.WriteUint64(uint64(o.Modified))
xw.WriteUint64(o.Version)
if len(o.Blocks) > 100000 {
if len(o.Blocks) > 1000000 {
return xw.Tot(), xdr.ErrElementSizeExceeded
}
xw.WriteUint32(uint32(len(o.Blocks)))
@ -105,7 +105,7 @@ func (o *FileInfo) decodeXDR(xr *xdr.Reader) error {
o.Modified = int64(xr.ReadUint64())
o.Version = xr.ReadUint64()
_BlocksSize := int(xr.ReadUint32())
if _BlocksSize > 100000 {
if _BlocksSize > 1000000 {
return xdr.ErrElementSizeExceeded
}
o.Blocks = make([]BlockInfo, _BlocksSize)