Browse Source

fix build and test

pull/1519/head
Ethan Buchman 6 years ago
parent
commit
64569b15e5
7 changed files with 22 additions and 10 deletions
  1. +11
    -1
      CHANGELOG.md
  2. +3
    -3
      p2p/errors.go
  3. +1
    -1
      p2p/node_info.go
  4. +1
    -1
      p2p/pex/addrbook.go
  5. +1
    -1
      p2p/pex/params.go
  6. +2
    -2
      p2p/pex/pex_reactor.go
  7. +3
    -1
      p2p/test_util.go

+ 11
- 1
CHANGELOG.md View File

@ -26,9 +26,19 @@ BUG FIXES:
## 0.19.2 (TBD)
FEATURES:
- [p2p] Allow peers with different Minor versions to connect
IMPROVEMENTS:
- [p2p] Various code comments cleanup
BUG FIXES:
- Fix reconnect to persistent peer when first dial fails
- [p2p] Fix reconnect to persistent peer when first dial fails
- [p2p] Validate NodeInfo.ListenAddr
- [p2p/pex] Limit max msg size to 64kB
## 0.19.1 (April 27th, 2018)


+ 3
- 3
p2p/errors.go View File

@ -26,7 +26,7 @@ type ErrNetAddressNoID struct {
}
func (e ErrNetAddressNoID) Error() string {
return fmt.Errorf("Address (%s) does not contain ID", e.Addr)
return fmt.Sprintf("Address (%s) does not contain ID", e.Addr)
}
type ErrNetAddressInvalid struct {
@ -35,7 +35,7 @@ type ErrNetAddressInvalid struct {
}
func (e ErrNetAddressInvalid) Error() string {
return fmt.Errorf("Invalid address (%s): %v", e.Addr, e.Err)
return fmt.Sprintf("Invalid address (%s): %v", e.Addr, e.Err)
}
type ErrNetAddressLookup struct {
@ -44,5 +44,5 @@ type ErrNetAddressLookup struct {
}
func (e ErrNetAddressLookup) Error() string {
return fmt.Errorf("Error looking up host (%s): %v", e.Addr, e.Err)
return fmt.Sprintf("Error looking up host (%s): %v", e.Addr, e.Err)
}

+ 1
- 1
p2p/node_info.go View File

@ -57,7 +57,7 @@ func (info NodeInfo) Validate() error {
}
// ensure ListenAddr is good
netAddr, err := NewNetAddressString(IDAddressString(info.ID, info.ListenAddr))
_, err := NewNetAddressString(IDAddressString(info.ID, info.ListenAddr))
if err != nil {
return err
}


+ 1
- 1
p2p/pex/addrbook.go View File

@ -623,7 +623,7 @@ func (a *addrBook) addAddress(addr, src *p2p.NetAddress) error {
}
// TODO: we should track ourAddrs by ID and by IP:PORT and refuse both.
if _, ok := a.ourAddrs[addr.String()]; ok {
return ErrAddrBookSelf
return ErrAddrBookSelf{addr}
}
ka := a.addrLookup[addr.ID]


+ 1
- 1
p2p/pex/params.go View File

@ -50,6 +50,6 @@ const (
minGetSelection = 32
// max addresses returned by GetSelection
// NOTE: this must match "maxPexMessageSize"
// NOTE: this must match "maxMsgSize"
maxGetSelection = 250
)

+ 2
- 2
p2p/pex/pex_reactor.go View File

@ -26,8 +26,8 @@ const (
maxAddressSize = 256
// NOTE: amplificaiton factor!
// small request results in up to maxPexMessageSize response
maxPexMessageSize = maxAddressSize * maxGetSelection
// small request results in up to maxMsgSize response
maxMsgSize = maxAddressSize * maxGetSelection
// ensure we have enough peers
defaultEnsurePeersPeriod = 30 * time.Second


+ 3
- 1
p2p/test_util.go View File

@ -49,6 +49,8 @@ func CreateRoutableAddr() (addr string, netAddr *NetAddress) {
//------------------------------------------------------------------
// Connects switches via arbitrary net.Conn. Used for testing.
const TEST_HOST = "localhost"
// MakeConnectedSwitches returns n switches, connected according to the connect func.
// If connect==Connect2Switches, the switches will be fully connected.
// initSwitch defines how the i'th switch should be initialized (ie. with what reactors).
@ -56,7 +58,7 @@ func CreateRoutableAddr() (addr string, netAddr *NetAddress) {
func MakeConnectedSwitches(cfg *cfg.P2PConfig, n int, initSwitch func(int, *Switch) *Switch, connect func([]*Switch, int, int)) []*Switch {
switches := make([]*Switch, n)
for i := 0; i < n; i++ {
switches[i] = MakeSwitch(cfg, i, "testing", "123.123.123", initSwitch)
switches[i] = MakeSwitch(cfg, i, TEST_HOST, "123.123.123", initSwitch)
}
if err := StartSwitches(switches); err != nil {


Loading…
Cancel
Save