Skip to content

Commit

Permalink
added network-info api call
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeam committed Feb 1, 2017
1 parent 9522e16 commit 558329d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
29 changes: 24 additions & 5 deletions wsapi/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ package wsapi
import (
"github.com/FactomProject/factomd/common/interfaces"
"github.com/FactomProject/factomd/common/primitives"

"fmt" // DEBUG

"encoding/json" // DEBUG
"fmt" // DEBUG
)

var _ = fmt.Sprintln("DEBUG")
Expand All @@ -26,7 +26,7 @@ func HandleHoldingQueue(
Messages []interfaces.IMsg
}
r := new(ret)

for _, v := range state.LoadHoldingMap() {
r.Messages = append(r.Messages, v)
}
Expand All @@ -45,6 +45,25 @@ func HandleNodeStatus(
}
r := new(ret)
r.Status = state.GetStatus()


return r, nil
}

func HandleNetworkInfo(
state interfaces.IState,
params interface{},
) (
interface{},
*primitives.JSONError,
) {
type ret struct {
NetworkNumber int
NetworkName string
NetworkID uint32
}
r := new(ret)
r.NetworkNumber = state.GetNetworkNumber()
r.NetworkName = state.GetNetworkName()
r.NetworkID = state.GetNetworkID()
return r, nil
}
}
3 changes: 3 additions & 0 deletions wsapi/wsapiV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func HandleV2Request(state interfaces.IState, j *primitives.JSON2Request) (*prim
case "node-status":
resp, jsonError = HandleNodeStatus(state, params)
break
case "network-info":
resp, jsonError = HandleNetworkInfo(state, params)
break

// END STATUS calls

Expand Down

0 comments on commit 558329d

Please sign in to comment.