aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/admin.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-30 03:26:47 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-30 03:26:47 +0800
commit04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0 (patch)
tree8065b02924ccbacb192ce33b74ea45a387819528 /cmd/geth/admin.go
parent24fc1f073dd5ec0302937fb51729991dd9a40ba3 (diff)
downloaddexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.tar
dexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.tar.gz
dexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.tar.bz2
dexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.tar.lz
dexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.tar.xz
dexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.tar.zst
dexon-04a7c4ae1e7fe9683854fd759cad0e5e04a2f2c0.zip
Abstract http into rpc package
New RpcConfig object to pass growing config
Diffstat (limited to 'cmd/geth/admin.go')
-rw-r--r--cmd/geth/admin.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go
index 3a58b8881..b217e88b5 100644
--- a/cmd/geth/admin.go
+++ b/cmd/geth/admin.go
@@ -2,8 +2,6 @@ package main
import (
"fmt"
- "net"
- "net/http"
"os"
"time"
@@ -70,12 +68,20 @@ func (js *jsre) startRPC(call otto.FunctionCall) otto.Value {
return otto.FalseValue()
}
- l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", addr, port))
+ config := rpc.RpcConfig{
+ ListenAddress: addr,
+ ListenPort: uint(port),
+ // CorsDomain: ctx.GlobalString(RPCCORSDomainFlag.Name),
+ }
+
+ xeth := xeth.New(js.ethereum, nil)
+ err = rpc.Start(xeth, config)
+
if err != nil {
- fmt.Printf("Can't listen on %s:%d: %v", addr, port, err)
+ fmt.Printf(err.Error())
return otto.FalseValue()
}
- go http.Serve(l, rpc.JSONRPC(xeth.New(js.ethereum, nil)))
+
return otto.TrueValue()
}