From 57f93d25bd9a09f4a68307342ad44a5af1d5dc26 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Thu, 16 Apr 2015 12:56:51 +0200 Subject: admin.stopRPC support added which stops the RPC HTTP listener --- cmd/geth/admin.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cmd/geth') diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index f8c717187..3b37cba75 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -26,6 +26,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) @@ -141,6 +142,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 { -- cgit