mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-02 22:21:44 +00:00
Use rpc/client/ws_client; OnStart() returns error
This commit is contained in:
@ -121,11 +121,12 @@ func (a *AddrBook) init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AddrBook) OnStart() {
|
||||
func (a *AddrBook) OnStart() error {
|
||||
a.QuitService.OnStart()
|
||||
a.loadFromFile(a.filePath)
|
||||
a.wg.Add(1)
|
||||
go a.saveRoutine()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *AddrBook) OnStop() {
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"time"
|
||||
|
||||
flow "github.com/tendermint/tendermint/Godeps/_workspace/src/code.google.com/p/mxk/go1/flowcontrol"
|
||||
"github.com/tendermint/tendermint/wire" //"github.com/tendermint/log15"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
"github.com/tendermint/tendermint/wire" //"github.com/tendermint/log15"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -127,7 +127,7 @@ func NewMConnection(conn net.Conn, chDescs []*ChannelDescriptor, onReceive recei
|
||||
return mconn
|
||||
}
|
||||
|
||||
func (c *MConnection) OnStart() {
|
||||
func (c *MConnection) OnStart() error {
|
||||
c.BaseService.OnStart()
|
||||
c.quit = make(chan struct{})
|
||||
c.flushTimer = NewThrottleTimer("flush", flushThrottleMS*time.Millisecond)
|
||||
@ -135,6 +135,7 @@ func (c *MConnection) OnStart() {
|
||||
c.chStatsTimer = NewRepeatTimer("chStats", updateStatsSeconds*time.Second)
|
||||
go c.sendRoutine()
|
||||
go c.recvRoutine()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *MConnection) OnStop() {
|
||||
|
@ -108,9 +108,10 @@ SKIP_UPNP:
|
||||
return dl
|
||||
}
|
||||
|
||||
func (l *DefaultListener) OnStart() {
|
||||
func (l *DefaultListener) OnStart() error {
|
||||
l.BaseService.OnStart()
|
||||
go l.listenRoutine()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *DefaultListener) OnStop() {
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"github.com/tendermint/tendermint/wire"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
"github.com/tendermint/tendermint/wire"
|
||||
)
|
||||
|
||||
type Peer struct {
|
||||
@ -72,9 +72,10 @@ func newPeer(conn net.Conn, peerNodeInfo *types.NodeInfo, outbound bool, reactor
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *Peer) OnStart() {
|
||||
func (p *Peer) OnStart() error {
|
||||
p.BaseService.OnStart()
|
||||
p.mconn.Start()
|
||||
_, err := p.mconn.Start()
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *Peer) OnStop() {
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/tendermint/tendermint/wire"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
"github.com/tendermint/tendermint/events"
|
||||
"github.com/tendermint/tendermint/wire"
|
||||
)
|
||||
|
||||
var pexErrInvalidMessage = errors.New("Invalid PEX message")
|
||||
@ -41,9 +41,10 @@ func NewPEXReactor(book *AddrBook) *PEXReactor {
|
||||
return pexR
|
||||
}
|
||||
|
||||
func (pexR *PEXReactor) OnStart() {
|
||||
func (pexR *PEXReactor) OnStart() error {
|
||||
pexR.BaseReactor.OnStart()
|
||||
go pexR.ensurePeersRoutine()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pexR *PEXReactor) OnStop() {
|
||||
|
@ -153,7 +153,7 @@ func (sw *Switch) SetNodePrivKey(nodePrivKey acm.PrivKeyEd25519) {
|
||||
}
|
||||
|
||||
// Switch.Start() starts all the reactors, peers, and listeners.
|
||||
func (sw *Switch) OnStart() {
|
||||
func (sw *Switch) OnStart() error {
|
||||
sw.BaseService.OnStart()
|
||||
// Start reactors
|
||||
for _, reactor := range sw.reactors {
|
||||
@ -167,6 +167,7 @@ func (sw *Switch) OnStart() {
|
||||
for _, listener := range sw.listeners {
|
||||
go sw.listenerRoutine(listener)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sw *Switch) OnStop() {
|
||||
|
Reference in New Issue
Block a user