mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
created "Node"
This commit is contained in:
@@ -95,6 +95,14 @@ func (na *NetAddress) Dial() (*Connection, error) {
|
||||
return NewConnection(conn), nil
|
||||
}
|
||||
|
||||
func (na *NetAddress) DialTimeout(timeout time.Duration) (*Connection, error) {
|
||||
conn, err := net.DialTimeout("tcp", na.String(), timeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewConnection(conn), nil
|
||||
}
|
||||
|
||||
func (na *NetAddress) Routable() bool {
|
||||
// TODO(oga) bitcoind doesn't include RFC3849 here, but should we?
|
||||
return na.Valid() && !(na.RFC1918() || na.RFC3927() || na.RFC4862() ||
|
||||
|
||||
@@ -55,6 +55,10 @@ func (p *Peer) stop() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Peer) IsOutgoing() bool {
|
||||
return p.outgoing
|
||||
}
|
||||
|
||||
func (p *Peer) LocalAddress() *NetAddress {
|
||||
return p.conn.LocalAddress()
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ func NewSwitch(channels []ChannelDescriptor) *Switch {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Switch) Start() {
|
||||
}
|
||||
|
||||
func (s *Switch) Stop() {
|
||||
log.Infof("Stopping switch")
|
||||
if atomic.CompareAndSwapUint32(&s.stopped, 0, 1) {
|
||||
|
||||
Reference in New Issue
Block a user