Browse Source

Include p2p connection status in RPC net_info

pull/176/head
Jae Kwon 9 years ago
parent
commit
f0c80837a6
2 changed files with 6 additions and 4 deletions
  1. +3
    -2
      rpc/core/net.go
  2. +3
    -2
      rpc/core/types/responses.go

+ 3
- 2
rpc/core/net.go View File

@ -15,8 +15,9 @@ func NetInfo() (*ctypes.ResultNetInfo, error) {
peers := []ctypes.Peer{}
for _, peer := range p2pSwitch.Peers().List() {
peers = append(peers, ctypes.Peer{
NodeInfo: *peer.NodeInfo,
IsOutbound: peer.IsOutbound(),
NodeInfo: *peer.NodeInfo,
IsOutbound: peer.IsOutbound(),
ConnectionStatus: peer.Connection().Status(),
})
}
return &ctypes.ResultNetInfo{


+ 3
- 2
rpc/core/types/responses.go View File

@ -38,8 +38,9 @@ type ResultNetInfo struct {
}
type Peer struct {
p2p.NodeInfo `json:"node_info"`
IsOutbound bool `json:"is_outbound"`
p2p.NodeInfo `json:"node_info"`
IsOutbound bool `json:"is_outbound"`
ConnectionStatus p2p.ConnectionStatus `json:"connection_status"`
}
type ResultListValidators struct {


Loading…
Cancel
Save