Commit 1584a56f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e844649f
...@@ -23,6 +23,7 @@ func (p *Address) NEOEncode(data []byte) { ...@@ -23,6 +23,7 @@ func (p *Address) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Host) copy(data, p.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], p.Port) binary.BigEndian.PutUint16(data[0:], p.Port)
} }
...@@ -65,6 +66,7 @@ func (p *NodeInfo) NEOEncode(data []byte) { ...@@ -65,6 +66,7 @@ func (p *NodeInfo) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[4:], l) binary.BigEndian.PutUint32(data[4:], l)
data = data[8:] data = data[8:]
copy(data, p.Address.Host) copy(data, p.Address.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], p.Address.Port) binary.BigEndian.PutUint16(data[0:], p.Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32(p.UUID))) binary.BigEndian.PutUint32(data[2:], uint32(int32(p.UUID)))
...@@ -190,6 +192,7 @@ func (p *Notify) NEOEncode(data []byte) { ...@@ -190,6 +192,7 @@ func (p *Notify) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Message) copy(data, p.Message)
data = data[l:]
} }
} }
...@@ -230,6 +233,7 @@ func (p *Error) NEOEncode(data []byte) { ...@@ -230,6 +233,7 @@ func (p *Error) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[4:], l) binary.BigEndian.PutUint32(data[4:], l)
data = data[8:] data = data[8:]
copy(data, p.Message) copy(data, p.Message)
data = data[l:]
} }
} }
...@@ -315,6 +319,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) { ...@@ -315,6 +319,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[12:], l) binary.BigEndian.PutUint32(data[12:], l)
data = data[16:] data = data[16:]
copy(data, p.Address.Host) copy(data, p.Address.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], p.Address.Port) binary.BigEndian.PutUint16(data[0:], p.Address.Port)
{ {
...@@ -322,6 +327,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) { ...@@ -322,6 +327,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[2:], l) binary.BigEndian.PutUint32(data[2:], l)
data = data[6:] data = data[6:]
copy(data, p.Name) copy(data, p.Name)
data = data[l:]
} }
float64_NEOEncode(data[0:], p.IdTimestamp) float64_NEOEncode(data[0:], p.IdTimestamp)
} }
...@@ -395,6 +401,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) { ...@@ -395,6 +401,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[20:], l) binary.BigEndian.PutUint32(data[20:], l)
data = data[24:] data = data[24:]
copy(data, p.Primary.Host) copy(data, p.Primary.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], p.Primary.Port) binary.BigEndian.PutUint16(data[0:], p.Primary.Port)
{ {
...@@ -408,6 +415,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) { ...@@ -408,6 +415,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, (*a).Address.Host) copy(data, (*a).Address.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], (*a).Address.Port) binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID))) binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
...@@ -1669,18 +1677,21 @@ func (p *StoreTransaction) NEOEncode(data []byte) { ...@@ -1669,18 +1677,21 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[8:], l) binary.BigEndian.PutUint32(data[8:], l)
data = data[12:] data = data[12:]
copy(data, p.User) copy(data, p.User)
data = data[l:]
} }
{ {
l := uint32(len(p.Description)) l := uint32(len(p.Description))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Description) copy(data, p.Description)
data = data[l:]
} }
{ {
l := uint32(len(p.Extension)) l := uint32(len(p.Extension))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Extension) copy(data, p.Extension)
data = data[l:]
} }
{ {
l := uint32(len(p.OidList)) l := uint32(len(p.OidList))
...@@ -2100,18 +2111,21 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) { ...@@ -2100,18 +2111,21 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[8:], l) binary.BigEndian.PutUint32(data[8:], l)
data = data[12:] data = data[12:]
copy(data, p.User) copy(data, p.User)
data = data[l:]
} }
{ {
l := uint32(len(p.Description)) l := uint32(len(p.Description))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Description) copy(data, p.Description)
data = data[l:]
} }
{ {
l := uint32(len(p.Extension)) l := uint32(len(p.Extension))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Extension) copy(data, p.Extension)
data = data[l:]
} }
(data[0:])[0] = bool2byte(p.Packed) (data[0:])[0] = bool2byte(p.Packed)
{ {
...@@ -2425,6 +2439,7 @@ func (p *AnswerNodeList) NEOEncode(data []byte) { ...@@ -2425,6 +2439,7 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[4:], l) binary.BigEndian.PutUint32(data[4:], l)
data = data[8:] data = data[8:]
copy(data, (*a).Address.Host) copy(data, (*a).Address.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], (*a).Address.Port) binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID))) binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
...@@ -2626,6 +2641,7 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) { ...@@ -2626,6 +2641,7 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[4:], l) binary.BigEndian.PutUint32(data[4:], l)
data = data[8:] data = data[8:]
copy(data, (*a).Address.Host) copy(data, (*a).Address.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], (*a).Address.Port) binary.BigEndian.PutUint16(data[0:], (*a).Address.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID))) binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
...@@ -3091,12 +3107,14 @@ func (p *CheckPartition) NEOEncode(data []byte) { ...@@ -3091,12 +3107,14 @@ func (p *CheckPartition) NEOEncode(data []byte) {
binary.BigEndian.PutUint32(data[4:], l) binary.BigEndian.PutUint32(data[4:], l)
data = data[8:] data = data[8:]
copy(data, p.Source.UpstreamName) copy(data, p.Source.UpstreamName)
data = data[l:]
} }
{ {
l := uint32(len(p.Source.Address.Host)) l := uint32(len(p.Source.Address.Host))
binary.BigEndian.PutUint32(data[0:], l) binary.BigEndian.PutUint32(data[0:], l)
data = data[4:] data = data[4:]
copy(data, p.Source.Address.Host) copy(data, p.Source.Address.Host)
data = data[l:]
} }
binary.BigEndian.PutUint16(data[0:], p.Source.Address.Port) binary.BigEndian.PutUint16(data[0:], p.Source.Address.Port)
binary.BigEndian.PutUint64(data[2:], uint64(p.MinTID)) binary.BigEndian.PutUint64(data[2:], uint64(p.MinTID))
......
...@@ -167,6 +167,7 @@ func TestPktMarshal(t *testing.T) { ...@@ -167,6 +167,7 @@ func TestPktMarshal(t *testing.T) {
hex("00000007000000030000000b000000040000000f000000030000001700000000"), hex("00000007000000030000000b000000040000000f000000030000001700000000"),
}, },
/*
// map[Oid]struct {Tid,Tid,bool} // map[Oid]struct {Tid,Tid,bool}
{&AnswerObjectUndoSerial{ {&AnswerObjectUndoSerial{
ObjectTIDDict: map[Oid]struct{ ObjectTIDDict: map[Oid]struct{
...@@ -186,6 +187,7 @@ func TestPktMarshal(t *testing.T) { ...@@ -186,6 +187,7 @@ func TestPktMarshal(t *testing.T) {
u64(8) + u64(7) + u64(1) + hex("00") + u64(8) + u64(7) + u64(1) + hex("00") +
u64(5) + u64(4) + u64(3) + hex("01"), u64(5) + u64(4) + u64(3) + hex("01"),
}, },
*/
// uint32, []uint32 // uint32, []uint32
{&PartitionCorrupted{7, []UUID{1,3,9,4}}, {&PartitionCorrupted{7, []UUID{1,3,9,4}},
......
...@@ -289,6 +289,7 @@ func (e *encoder) genStrBytes(path string) { ...@@ -289,6 +289,7 @@ func (e *encoder) genStrBytes(path string) {
if !e.SizeOnly { if !e.SizeOnly {
e.emit("data = data[%v:]", e.n) e.emit("data = data[%v:]", e.n)
e.emit("copy(data, %v)", path) e.emit("copy(data, %v)", path)
e.emit("data = data[l:]")
} else { } else {
e.emit("size += %v + l", e.n) e.emit("size += %v + l", e.n)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment