Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
5f50fe7a
Commit
5f50fe7a
authored
Jan 27, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CLI to use new Websocket RPC
Use “wsport” flag to change default port
parent
b8e7b8e2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
5 deletions
+19
-5
flags.go
cmd/ethereum/flags.go
+2
-0
main.go
cmd/ethereum/main.go
+1
-1
cmd.go
cmd/utils/cmd.go
+12
-4
backend.go
eth/backend.go
+4
-0
No files found.
cmd/ethereum/flags.go
View file @
5f50fe7a
...
@@ -41,6 +41,7 @@ var (
...
@@ -41,6 +41,7 @@ var (
StartRpc
bool
StartRpc
bool
StartWebSockets
bool
StartWebSockets
bool
RpcPort
int
RpcPort
int
WsPort
int
NatType
string
NatType
string
PMPGateway
string
PMPGateway
string
OutboundPort
string
OutboundPort
string
...
@@ -96,6 +97,7 @@ func Init() {
...
@@ -96,6 +97,7 @@ func Init() {
flag
.
StringVar
(
&
PMPGateway
,
"pmp"
,
""
,
"Gateway IP for PMP"
)
flag
.
StringVar
(
&
PMPGateway
,
"pmp"
,
""
,
"Gateway IP for PMP"
)
flag
.
IntVar
(
&
MaxPeer
,
"maxpeer"
,
30
,
"maximum desired peers"
)
flag
.
IntVar
(
&
MaxPeer
,
"maxpeer"
,
30
,
"maximum desired peers"
)
flag
.
IntVar
(
&
RpcPort
,
"rpcport"
,
8080
,
"port to start json-rpc server on"
)
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
(
&
StartRpc
,
"rpc"
,
false
,
"start rpc server"
)
flag
.
BoolVar
(
&
StartWebSockets
,
"ws"
,
false
,
"start websocket server"
)
flag
.
BoolVar
(
&
StartWebSockets
,
"ws"
,
false
,
"start websocket server"
)
flag
.
BoolVar
(
&
NonInteractive
,
"y"
,
false
,
"non-interactive mode (say yes to confirmations)"
)
flag
.
BoolVar
(
&
NonInteractive
,
"y"
,
false
,
"non-interactive mode (say yes to confirmations)"
)
...
...
cmd/ethereum/main.go
View file @
5f50fe7a
...
@@ -131,7 +131,7 @@ func main() {
...
@@ -131,7 +131,7 @@ func main() {
}
}
if
StartWebSockets
{
if
StartWebSockets
{
utils
.
StartWebSockets
(
ethereum
)
utils
.
StartWebSockets
(
ethereum
,
WsPort
)
}
}
utils
.
StartEthereum
(
ethereum
,
UseSeed
)
utils
.
StartEthereum
(
ethereum
,
UseSeed
)
...
...
cmd/utils/cmd.go
View file @
5f50fe7a
...
@@ -39,8 +39,9 @@ import (
...
@@ -39,8 +39,9 @@ import (
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
rpchttp
"github.com/ethereum/go-ethereum/rpc/http"
rpchttp
"github.com/ethereum/go-ethereum/rpc/http"
rpcws
"github.com/ethereum/go-ethereum/rpc/websocket"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/websocket"
//
"github.com/ethereum/go-ethereum/websocket"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
...
@@ -201,11 +202,18 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
...
@@ -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"
)
clilogger
.
Infoln
(
"Starting WebSockets"
)
sock
:=
websocket
.
NewWebSocketServer
(
eth
)
// sock := websocket.NewWebSocketServer(eth)
go
sock
.
Serv
()
// 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
var
gminer
*
miner
.
Miner
...
...
eth/backend.go
View file @
5f50fe7a
...
@@ -67,6 +67,7 @@ type Ethereum struct {
...
@@ -67,6 +67,7 @@ type Ethereum struct {
blockSub
event
.
Subscription
blockSub
event
.
Subscription
RpcServer
rpc
.
RpcServer
RpcServer
rpc
.
RpcServer
WsServer
rpc
.
RpcServer
keyManager
*
crypto
.
KeyManager
keyManager
*
crypto
.
KeyManager
clientIdentity
p2p
.
ClientIdentity
clientIdentity
p2p
.
ClientIdentity
...
@@ -276,6 +277,9 @@ func (s *Ethereum) Stop() {
...
@@ -276,6 +277,9 @@ func (s *Ethereum) Stop() {
if
s
.
RpcServer
!=
nil
{
if
s
.
RpcServer
!=
nil
{
s
.
RpcServer
.
Stop
()
s
.
RpcServer
.
Stop
()
}
}
if
s
.
WsServer
!=
nil
{
s
.
WsServer
.
Stop
()
}
s
.
txPool
.
Stop
()
s
.
txPool
.
Stop
()
s
.
eventMux
.
Stop
()
s
.
eventMux
.
Stop
()
s
.
blockPool
.
Stop
()
s
.
blockPool
.
Stop
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment