Browse Source

Increase maximum allowed file size to 10 Mblocks

Upgrade FileInfo up to 10000000 blocks. 1310 GB files can be shared.
Increase limit when unmarshaling XDR.
Increase the size of message.
Laurent Etiemble 9 years ago
parent
commit
c8b6e6fd9b
4 changed files with 12 additions and 12 deletions
  1. 3 3
      lib/db/truncated.go
  2. 1 1
      lib/protocol/message.go
  3. 6 6
      lib/protocol/message_xdr.go
  4. 2 2
      lib/protocol/protocol.go

+ 3 - 3
lib/db/truncated.go

@@ -27,12 +27,12 @@ func (o *FileInfoTruncated) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
 	o.LocalVersion = int64(u.UnmarshalUint64())
 	o.LocalVersion = int64(u.UnmarshalUint64())
 	_BlocksSize := int(u.UnmarshalUint32())
 	_BlocksSize := int(u.UnmarshalUint32())
 	if _BlocksSize < 0 {
 	if _BlocksSize < 0 {
-		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
+		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
 	} else if _BlocksSize == 0 {
 	} else if _BlocksSize == 0 {
 		o.Blocks = nil
 		o.Blocks = nil
 	} else {
 	} else {
-		if _BlocksSize > 1000000 {
-			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
+		if _BlocksSize > 10000000 {
+			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
 		}
 		}
 		for i := 0; i < _BlocksSize; i++ {
 		for i := 0; i < _BlocksSize; i++ {
 			size := int64(u.UnmarshalUint32())
 			size := int64(u.UnmarshalUint32())

+ 1 - 1
lib/protocol/message.go

@@ -27,7 +27,7 @@ type FileInfo struct {
 	Version      Vector
 	Version      Vector
 	LocalVersion int64
 	LocalVersion int64
 	CachedSize   int64       // noencode (cache only)
 	CachedSize   int64       // noencode (cache only)
-	Blocks       []BlockInfo // max:1000000
+	Blocks       []BlockInfo // max:10000000
 }
 }
 
 
 func (f FileInfo) String() string {
 func (f FileInfo) String() string {

+ 6 - 6
lib/protocol/message_xdr.go

@@ -176,7 +176,7 @@ struct FileInfo {
 	hyper Modified;
 	hyper Modified;
 	Vector Version;
 	Vector Version;
 	hyper LocalVersion;
 	hyper LocalVersion;
-	BlockInfo Blocks<1000000>;
+	BlockInfo Blocks<10000000>;
 }
 }
 
 
 */
 */
@@ -212,8 +212,8 @@ func (o FileInfo) MarshalXDRInto(m *xdr.Marshaller) error {
 		return err
 		return err
 	}
 	}
 	m.MarshalUint64(uint64(o.LocalVersion))
 	m.MarshalUint64(uint64(o.LocalVersion))
-	if l := len(o.Blocks); l > 1000000 {
-		return xdr.ElementSizeExceeded("Blocks", l, 1000000)
+	if l := len(o.Blocks); l > 10000000 {
+		return xdr.ElementSizeExceeded("Blocks", l, 10000000)
 	}
 	}
 	m.MarshalUint32(uint32(len(o.Blocks)))
 	m.MarshalUint32(uint32(len(o.Blocks)))
 	for i := range o.Blocks {
 	for i := range o.Blocks {
@@ -236,12 +236,12 @@ func (o *FileInfo) UnmarshalXDRFrom(u *xdr.Unmarshaller) error {
 	o.LocalVersion = int64(u.UnmarshalUint64())
 	o.LocalVersion = int64(u.UnmarshalUint64())
 	_BlocksSize := int(u.UnmarshalUint32())
 	_BlocksSize := int(u.UnmarshalUint32())
 	if _BlocksSize < 0 {
 	if _BlocksSize < 0 {
-		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
+		return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
 	} else if _BlocksSize == 0 {
 	} else if _BlocksSize == 0 {
 		o.Blocks = nil
 		o.Blocks = nil
 	} else {
 	} else {
-		if _BlocksSize > 1000000 {
-			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 1000000)
+		if _BlocksSize > 10000000 {
+			return xdr.ElementSizeExceeded("Blocks", _BlocksSize, 10000000)
 		}
 		}
 		if _BlocksSize <= len(o.Blocks) {
 		if _BlocksSize <= len(o.Blocks) {
 			o.Blocks = o.Blocks[:_BlocksSize]
 			o.Blocks = o.Blocks[:_BlocksSize]

+ 2 - 2
lib/protocol/protocol.go

@@ -19,8 +19,8 @@ const (
 	// BlockSize is the standard ata block size (128 KiB)
 	// BlockSize is the standard ata block size (128 KiB)
 	BlockSize = 128 << 10
 	BlockSize = 128 << 10
 
 
-	// MaxMessageLen is the largest message size allowed on the wire. (64 MiB)
-	MaxMessageLen = 64 << 20
+	// MaxMessageLen is the largest message size allowed on the wire. (512 MiB)
+	MaxMessageLen = 64 << 23
 )
 )
 
 
 const (
 const (