aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-28 21:52:09 +0800
committerobscuren <geffobscura@gmail.com>2015-01-28 21:52:09 +0800
commitb46e1ca97e61ebfe4c37961e723142245efe5016 (patch)
tree45838760ad08592995cd1051c29c6d41d08cd24c /cmd
parent159c4d56cd82d6fe721058557977f4efda31661c (diff)
parente9d017ba082bfd624267c974fa93a77da6269756 (diff)
downloadgo-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.tar
go-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.gz
go-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.bz2
go-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.lz
go-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.xz
go-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.tar.zst
go-tangerine-b46e1ca97e61ebfe4c37961e723142245efe5016.zip
Merge branch 'jsonrpc' of github.com-obscure:ethereum/go-ethereum into jsonrpc
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/flags.go2
-rw-r--r--cmd/ethereum/main.go2
-rw-r--r--cmd/mist/flags.go2
-rw-r--r--cmd/mist/main.go2
-rw-r--r--cmd/utils/cmd.go20
5 files changed, 20 insertions, 8 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go
index f829744dc..e0fbbb008 100644
--- a/cmd/ethereum/flags.go
+++ b/cmd/ethereum/flags.go
@@ -41,6 +41,7 @@ var (
StartRpc bool
StartWebSockets bool
RpcPort int
+ WsPort int
NatType string
PMPGateway string
OutboundPort string
@@ -96,6 +97,7 @@ func Init() {
flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for PMP")
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on")
+ flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on")
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index b816c678e..92dbf5a6f 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -131,7 +131,7 @@ func main() {
}
if StartWebSockets {
- utils.StartWebSockets(ethereum)
+ utils.StartWebSockets(ethereum, WsPort)
}
utils.StartEthereum(ethereum, UseSeed)
diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go
index 8a67cdd0a..f530394c2 100644
--- a/cmd/mist/flags.go
+++ b/cmd/mist/flags.go
@@ -43,6 +43,7 @@ var (
StartRpc bool
StartWebSockets bool
RpcPort int
+ WsPort int
UseUPnP bool
NatType string
OutboundPort string
@@ -111,6 +112,7 @@ func Init() {
flag.BoolVar(&UseUPnP, "upnp", true, "enable UPnP support")
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on")
+ flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on")
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
diff --git a/cmd/mist/main.go b/cmd/mist/main.go
index eb0a80add..bcfb7f2ec 100644
--- a/cmd/mist/main.go
+++ b/cmd/mist/main.go
@@ -73,7 +73,7 @@ func run() error {
}
if StartWebSockets {
- utils.StartWebSockets(ethereum)
+ utils.StartWebSockets(ethereum, WsPort)
}
gui := NewWindow(ethereum, config, ethereum.ClientIdentity().(*p2p.SimpleClientIdentity), KeyRing, LogLevel)
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 95a7f89c8..9cdd8b5d1 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -38,9 +38,10 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/rlp"
- "github.com/ethereum/go-ethereum/rpc"
+ rpchttp "github.com/ethereum/go-ethereum/rpc/http"
+ rpcws "github.com/ethereum/go-ethereum/rpc/ws"
"github.com/ethereum/go-ethereum/state"
- "github.com/ethereum/go-ethereum/websocket"
+ // "github.com/ethereum/go-ethereum/websocket"
"github.com/ethereum/go-ethereum/xeth"
)
@@ -193,7 +194,7 @@ func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, Secre
func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
var err error
- ethereum.RpcServer, err = rpc.NewJsonRpcServer(xeth.NewJSXEth(ethereum), RpcPort)
+ ethereum.RpcServer, err = rpchttp.NewRpcHttpServer(xeth.NewJSXEth(ethereum), RpcPort)
if err != nil {
clilogger.Errorf("Could not start RPC interface (port %v): %v", RpcPort, err)
} else {
@@ -201,11 +202,18 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
}
}
-func StartWebSockets(eth *eth.Ethereum) {
+func StartWebSockets(eth *eth.Ethereum, wsPort int) {
clilogger.Infoln("Starting WebSockets")
- sock := websocket.NewWebSocketServer(eth)
- go sock.Serv()
+ // sock := websocket.NewWebSocketServer(eth)
+ // go sock.Serv()
+ var err error
+ eth.WsServer, err = rpcws.NewWebSocketServer(eth, wsPort)
+ if err != nil {
+ clilogger.Errorf("Could not start RPC interface (port %v): %v", wsPort, err)
+ } else {
+ go eth.WsServer.Start()
+ }
}
var gminer *miner.Miner