diff options
Diffstat (limited to 'cmd/geth')
-rw-r--r-- | cmd/geth/admin.go | 8 | ||||
-rw-r--r-- | cmd/geth/main.go | 17 |
2 files changed, 18 insertions, 7 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index defbb43ec..bd09291bf 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -28,6 +28,7 @@ func (js *jsre) adminBindings() { admin := t.Object() admin.Set("suggestPeer", js.suggestPeer) admin.Set("startRPC", js.startRPC) + admin.Set("stopRPC", js.stopRPC) admin.Set("nodeInfo", js.nodeInfo) admin.Set("peers", js.peers) admin.Set("newAccount", js.newAccount) @@ -226,6 +227,13 @@ func (js *jsre) startRPC(call otto.FunctionCall) otto.Value { return otto.TrueValue() } +func (js *jsre) stopRPC(call otto.FunctionCall) otto.Value { + if rpc.Stop() == nil { + return otto.TrueValue() + } + return otto.FalseValue() +} + func (js *jsre) suggestPeer(call otto.FunctionCall) otto.Value { nodeURL, err := call.Argument(0).ToString() if err != nil { diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 97d358407..ddbd1f129 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -24,8 +24,6 @@ import ( "bufio" "fmt" "io/ioutil" - "log" - "net/http" "os" "runtime" "strconv" @@ -237,6 +235,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, + utils.WhisperEnabledFlag, utils.VMDebugFlag, utils.ProtocolVersionFlag, utils.NetworkIdFlag, @@ -247,6 +246,14 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.LogVModuleFlag, utils.LogFileFlag, utils.LogJSONFlag, + utils.PProfEanbledFlag, + utils.PProfPortFlag, + } + app.Before = func(ctx *cli.Context) error { + if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { + utils.StartPProf(ctx) + } + return nil } // missing: @@ -261,11 +268,6 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso } func main() { - // Start up the default http server for pprof - go func() { - log.Println(http.ListenAndServe("localhost:6060", nil)) - }() - fmt.Printf("Welcome to the FRONTIER\n") runtime.GOMAXPROCS(runtime.NumCPU()) defer logger.Flush() @@ -337,6 +339,7 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (pass } func startEth(ctx *cli.Context, eth *eth.Ethereum) { + // Start Ethereum itself utils.StartEthereum(eth) am := eth.AccountManager() |