start peer before AddPeer() on reactors.

This commit is contained in:
Jae Kwon
2015-03-25 13:22:46 -07:00
parent a2b8318aac
commit bd6d9d646d
2 changed files with 5 additions and 5 deletions

View File

@@ -225,8 +225,8 @@ func (conR *ConsensusReactor) SetPrivValidator(priv *sm.PrivValidator) {
conR.conS.SetPrivValidator(priv) conR.conS.SetPrivValidator(priv)
} }
// Fast forward to some state. // Reset to some state.
func (conR *ConsensusReactor) UpdateToState(state *sm.State) { func (conR *ConsensusReactor) ResetToState(state *sm.State) {
conR.conS.updateToState(state, false) conR.conS.updateToState(state, false)
} }

View File

@@ -131,12 +131,12 @@ func (sw *Switch) AddPeerWithConnection(conn net.Conn, outbound bool) (*Peer, er
return nil, ErrSwitchDuplicatePeer return nil, ErrSwitchDuplicatePeer
} }
// Notify listeners.
sw.doAddPeer(peer)
// Start the peer // Start the peer
go peer.start() go peer.start()
// Notify listeners.
sw.doAddPeer(peer)
// Send handshake // Send handshake
msg := &pexHandshakeMessage{Network: sw.network} msg := &pexHandshakeMessage{Network: sw.network}
peer.Send(PexChannel, msg) peer.Send(PexChannel, msg)