Update protocol dep

This commit is contained in:
Jakob Borg 2015-03-09 21:21:50 +01:00
parent 1e376cd3a6
commit 03bbf273b3
3 changed files with 8 additions and 17 deletions

2
Godeps/Godeps.json generated
View File

@ -31,7 +31,7 @@
},
{
"ImportPath": "github.com/syncthing/protocol",
"Rev": "2e2d479103df8fb721d55d59b0198d6c24f4865b"
"Rev": "cd0cce4195105cefab80fce84664188b614032e8"
},
{
"ImportPath": "github.com/syndtr/goleveldb/leveldb",

View File

@ -7,7 +7,7 @@ package protocol
import "fmt"
type IndexMessage struct {
Folder string // max:64
Folder string
Files []FileInfo
Flags uint32
Options []Option // max:64
@ -83,9 +83,9 @@ type ResponseMessage struct {
}
type ClusterConfigMessage struct {
ClientName string // max:64
ClientVersion string // max:64
Folders []Folder // max:64
ClientName string // max:64
ClientVersion string // max:64
Folders []Folder
Options []Option // max:64
}

View File

@ -41,7 +41,7 @@ IndexMessage Structure:
struct IndexMessage {
string Folder<64>;
string Folder<>;
FileInfo Files<>;
unsigned int Flags;
Option Options<64>;
@ -74,9 +74,6 @@ func (o IndexMessage) AppendXDR(bs []byte) ([]byte, error) {
}
func (o IndexMessage) encodeXDR(xw *xdr.Writer) (int, error) {
if l := len(o.Folder); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("Folder", l, 64)
}
xw.WriteString(o.Folder)
xw.WriteUint32(uint32(len(o.Files)))
for i := range o.Files {
@ -111,7 +108,7 @@ func (o *IndexMessage) UnmarshalXDR(bs []byte) error {
}
func (o *IndexMessage) decodeXDR(xr *xdr.Reader) error {
o.Folder = xr.ReadStringMax(64)
o.Folder = xr.ReadString()
_FilesSize := int(xr.ReadUint32())
o.Files = make([]FileInfo, _FilesSize)
for i := range o.Files {
@ -559,7 +556,7 @@ ClusterConfigMessage Structure:
struct ClusterConfigMessage {
string ClientName<64>;
string ClientVersion<64>;
Folder Folders<64>;
Folder Folders<>;
Option Options<64>;
}
@ -598,9 +595,6 @@ func (o ClusterConfigMessage) encodeXDR(xw *xdr.Writer) (int, error) {
return xw.Tot(), xdr.ElementSizeExceeded("ClientVersion", l, 64)
}
xw.WriteString(o.ClientVersion)
if l := len(o.Folders); l > 64 {
return xw.Tot(), xdr.ElementSizeExceeded("Folders", l, 64)
}
xw.WriteUint32(uint32(len(o.Folders)))
for i := range o.Folders {
_, err := o.Folders[i].encodeXDR(xw)
@ -636,9 +630,6 @@ func (o *ClusterConfigMessage) decodeXDR(xr *xdr.Reader) error {
o.ClientName = xr.ReadStringMax(64)
o.ClientVersion = xr.ReadStringMax(64)
_FoldersSize := int(xr.ReadUint32())
if _FoldersSize > 64 {
return xdr.ElementSizeExceeded("Folders", _FoldersSize, 64)
}
o.Folders = make([]Folder, _FoldersSize)
for i := range o.Folders {
(&o.Folders[i]).decodeXDR(xr)