aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-02-13 20:53:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-02-13 20:53:48 +0800
commit770b29fd80b8f25be31c2db5af6904cc5d0688ef (patch)
tree7b9da6bc13f6e881dd3a4ae231e9c69b6d9bbfeb /cmd/geth/main.go
parentb05e472c076d30035233d6a8b5fb3360b236e3ff (diff)
parentdf75dbfd6804923b1c8a8388b67523072d59f155 (diff)
downloaddexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.tar
dexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.tar.gz
dexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.tar.bz2
dexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.tar.lz
dexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.tar.xz
dexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.tar.zst
dexon-770b29fd80b8f25be31c2db5af6904cc5d0688ef.zip
Merge pull request #2175 from karalabe/refactor-http-rpc
cmd, common, node, rpc: move HTTP RPC into node, drop singleton aspect
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go24
1 files changed, 9 insertions, 15 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index fa456a7ac..8594d18c5 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -399,7 +399,7 @@ func attach(ctx *cli.Context) {
// attach to a running geth instance
client, err := utils.NewRemoteRPCClient(ctx)
if err != nil {
- utils.Fatalf("Unable to attach to geth - %v", err)
+ utils.Fatalf("Unable to attach to geth: %v", err)
}
repl := newLightweightJSRE(
@@ -425,8 +425,10 @@ func console(ctx *cli.Context) {
startNode(ctx, node)
// Attach to the newly started node, and either execute script or become interactive
- client := utils.NewInProcRPCClient(node)
-
+ client, err := node.Attach()
+ if err != nil {
+ utils.Fatalf("Failed to attach to the inproc geth: %v", err)
+ }
repl := newJSRE(node,
ctx.GlobalString(utils.JSpathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
@@ -449,8 +451,10 @@ func execScripts(ctx *cli.Context) {
startNode(ctx, node)
// Attach to the newly started node and execute the given scripts
- client := utils.NewInProcRPCClient(node)
-
+ client, err := node.Attach()
+ if err != nil {
+ utils.Fatalf("Failed to attach to the inproc geth: %v", err)
+ }
repl := newJSRE(node,
ctx.GlobalString(utils.JSpathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
@@ -503,16 +507,6 @@ func startNode(ctx *cli.Context, stack *node.Node) {
}
}
// Start auxiliary services if enabled
- if ctx.GlobalBool(utils.RPCEnabledFlag.Name) {
- if err := utils.StartRPC(stack, ctx); err != nil {
- utils.Fatalf("Failed to start RPC: %v", err)
- }
- }
- if ctx.GlobalBool(utils.WSEnabledFlag.Name) {
- if err := utils.StartWS(stack, ctx); err != nil {
- utils.Fatalf("Failed to start WS: %v", err)
- }
- }
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) {
if err := ethereum.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name), ctx.GlobalString(utils.MiningGPUFlag.Name)); err != nil {
utils.Fatalf("Failed to start mining: %v", err)