fix: remove more field

We no longer need it now that we keep reading till the stream closes.
This commit is contained in:
Steven Allen 2020-06-03 15:41:08 -07:00
parent 513e13d0d2
commit b22add866a
3 changed files with 18 additions and 70 deletions

View File

@ -464,7 +464,6 @@ func (ids *IDService) writeChunkedIdentifyMsg(c network.Conn, snapshot *identify
return writer.WriteMsg(mes)
}
mes.SignedPeerRecord = nil
mes.More = true
if err := writer.WriteMsg(mes); err != nil {
return err
}

View File

@ -5,7 +5,6 @@ package identify_pb
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
@ -100,10 +99,6 @@ type Identify struct {
Protocols []string `protobuf:"bytes,3,rep,name=protocols" json:"protocols,omitempty"`
// a delta update is incompatible with everything else. If this field is included, none of the others can appear.
Delta *Delta `protobuf:"bytes,7,opt,name=delta" json:"delta,omitempty"`
// more is set to true by a peer to indicate to the receiver that the signed record is absent in the current message
// and the peer should read the next message from the stream to fetch it.
// This is done because messages with signed records can exceed the legacy message size of 2K bytes.
More bool `protobuf:"varint,9,opt,name=more" json:"more"`
// signedPeerRecord contains a serialized SignedEnvelope containing a PeerRecord,
// signed by the sending node. It contains the same addresses as the listenAddrs field, but
// in a form that lets us share authenticated addrs with other peers.
@ -197,13 +192,6 @@ func (m *Identify) GetDelta() *Delta {
return nil
}
func (m *Identify) GetMore() bool {
if m != nil {
return m.More
}
return false
}
func (m *Identify) GetSignedPeerRecord() []byte {
if m != nil {
return m.SignedPeerRecord
@ -219,27 +207,24 @@ func init() {
func init() { proto.RegisterFile("identify.proto", fileDescriptor_83f1e7e6b485409f) }
var fileDescriptor_83f1e7e6b485409f = []byte{
// 316 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xcd, 0x4a, 0xf3, 0x40,
0x14, 0x86, 0xbf, 0xe9, 0xcf, 0x67, 0x73, 0x12, 0x5a, 0x99, 0xd5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0x91, 0x3a, 0x44, 0xeb, 0x1d, 0x36, 0xad, 0xd1, 0xbd, 0xa1, 0x5e, 0x03,
0xd1, 0xa2, 0x27, 0x8e, 0x18, 0xed, 0xd8, 0x9d, 0xd7, 0xa4, 0xf3, 0xf6, 0x80, 0x4b, 0x68, 0xeb,
0x75, 0x63, 0xe2, 0x24, 0x66, 0x32, 0xbc, 0xe5, 0xc9, 0x41, 0xfb, 0x09, 0x75, 0xa9, 0x36, 0x02,
0x17, 0xd0, 0x2a, 0xad, 0x43, 0x11, 0xc4, 0x4c, 0x76, 0x46, 0xad, 0xe5, 0xe7, 0xc5, 0x3f, 0x45,
0x84, 0x5f, 0xc3, 0x69, 0x6d, 0xf2, 0x0a, 0xf5, 0x18, 0xd1, 0x29, 0xcc, 0xac, 0xd3, 0xa2, 0x43,
0x49, 0xfe, 0xf0, 0x51, 0xb4, 0x5c, 0xf5, 0xd9, 0xc7, 0xaa, 0xcf, 0xbe, 0x56, 0x7d, 0xf6, 0x1d,
0x00, 0x00, 0xff, 0xff, 0xff, 0xed, 0x85, 0x1b, 0xfc, 0x01, 0x00, 0x00,
// 272 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x41, 0x4a, 0xc3, 0x40,
0x14, 0x86, 0x99, 0xd6, 0x6a, 0xf3, 0x12, 0x5a, 0x99, 0xd5, 0x2c, 0x24, 0xc4, 0x6c, 0x1c, 0x5c,
0x64, 0xe1, 0x0d, 0x14, 0x37, 0xe2, 0xa6, 0x8c, 0xe0, 0x56, 0x92, 0xbc, 0x67, 0x19, 0x48, 0x33,
0x65, 0x32, 0x0a, 0xbd, 0x95, 0xc7, 0x70, 0xe9, 0x11, 0x24, 0x27, 0x91, 0x4c, 0x4d, 0x93, 0xea,
0x72, 0x3e, 0x3e, 0xe6, 0x7f, 0xff, 0x0f, 0x0b, 0x8d, 0x54, 0x3b, 0xfd, 0xba, 0xc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x00, 0xff, 0xff, 0xc0, 0x03, 0xc8, 0x41, 0xb3, 0x01, 0x00, 0x00,
}
func (m *Delta) Marshal() (dAtA []byte, err error) {
@ -311,14 +296,6 @@ func (m *Identify) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
i--
if m.More {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x48
if m.SignedPeerRecord != nil {
i -= len(m.SignedPeerRecord)
copy(dAtA[i:], m.SignedPeerRecord)
@ -464,7 +441,6 @@ func (m *Identify) Size() (n int) {
l = len(m.SignedPeerRecord)
n += 1 + l + sovIdentify(uint64(l))
}
n += 2
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
@ -892,26 +868,6 @@ func (m *Identify) Unmarshal(dAtA []byte) error {
m.SignedPeerRecord = []byte{}
}
iNdEx = postIndex
case 9:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field More", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowIdentify
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.More = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipIdentify(dAtA[iNdEx:])

View File

@ -2,8 +2,6 @@ syntax = "proto2";
package identify.pb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message Delta {
// new protocols now serviced by the peer.
repeated string added_protocols = 1;
@ -39,11 +37,6 @@ message Identify {
// a delta update is incompatible with everything else. If this field is included, none of the others can appear.
optional Delta delta = 7;
// more is set to true by a peer to indicate to the receiver that the signed record is absent in the current message
// and the peer should read the next message from the stream to fetch it.
// This is done because messages with signed records can exceed the legacy message size of 2K bytes.
optional bool more = 9 [(gogoproto.nullable) = false];
// signedPeerRecord contains a serialized SignedEnvelope containing a PeerRecord,
// signed by the sending node. It contains the same addresses as the listenAddrs field, but
// in a form that lets us share authenticated addrs with other peers.