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
0c77a962
Commit
0c77a962
authored
Jan 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move websockets out of cmd/util
parent
d92fde69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
29 deletions
+22
-29
cmd.go
cmd/utils/cmd.go
+8
-0
util.go
websocket/util.go
+14
-29
No files found.
cmd/utils/cmd.go
View file @
0c77a962
...
@@ -40,6 +40,7 @@ import (
...
@@ -40,6 +40,7 @@ import (
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/websocket"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
...
@@ -200,6 +201,13 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
...
@@ -200,6 +201,13 @@ func StartRpc(ethereum *eth.Ethereum, RpcPort int) {
}
}
}
}
func
StartWebSockets
(
eth
*
eth
.
Ethereum
)
{
clilogger
.
Infoln
(
"Starting WebSockets"
)
sock
:=
websocket
.
NewWebSocketServer
(
eth
)
go
sock
.
Serv
()
}
var
gminer
*
miner
.
Miner
var
gminer
*
miner
.
Miner
func
GetMiner
()
*
miner
.
Miner
{
func
GetMiner
()
*
miner
.
Miner
{
...
...
cmd/utils/websockets
.go
→
websocket/util
.go
View file @
0c77a962
/*
/*
This file is part of go-ethereum
This file is part of go-ethereum
go-ethereum is free software: you can redistribute it and/or modify
go-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
(at your option) any later version.
go-ethereum is distributed in the hope that it will be useful,
go-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
*/
/**
package
websocket
* @authors
* Jeffrey Wilcke <i@jev.io>
*/
package
utils
import
(
import
(
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
...
@@ -26,15 +22,11 @@ import (
...
@@ -26,15 +22,11 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/ui"
"github.com/ethereum/go-ethereum/ui"
"github.com/ethereum/go-ethereum/websocket"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
var
wslogger
=
logger
.
NewLogger
(
"WS"
)
func
args
(
v
...
interface
{})
[]
interface
{}
{
func
args
(
v
...
interface
{})
[]
interface
{}
{
return
v
return
v
}
}
...
@@ -54,8 +46,8 @@ func NewWebSocketServer(eth *eth.Ethereum) *WebSocketServer {
...
@@ -54,8 +46,8 @@ func NewWebSocketServer(eth *eth.Ethereum) *WebSocketServer {
func
(
self
*
WebSocketServer
)
Serv
()
{
func
(
self
*
WebSocketServer
)
Serv
()
{
pipe
:=
xeth
.
NewJSXEth
(
self
.
eth
)
pipe
:=
xeth
.
NewJSXEth
(
self
.
eth
)
wsServ
:=
websocket
.
NewServer
(
"/eth"
,
":40404"
)
wsServ
:=
NewServer
(
"/eth"
,
":40404"
)
wsServ
.
MessageFunc
(
func
(
c
*
websocket
.
Client
,
msg
*
websocket
.
Message
)
{
wsServ
.
MessageFunc
(
func
(
c
*
Client
,
msg
*
Message
)
{
switch
msg
.
Call
{
switch
msg
.
Call
{
case
"compile"
:
case
"compile"
:
data
:=
ethutil
.
NewValue
(
msg
.
Args
)
data
:=
ethutil
.
NewValue
(
msg
.
Args
)
...
@@ -162,13 +154,6 @@ func toMessages(messages state.Messages) (msgs []xeth.JSMessage) {
...
@@ -162,13 +154,6 @@ func toMessages(messages state.Messages) (msgs []xeth.JSMessage) {
return
return
}
}
func
StartWebSockets
(
eth
*
eth
.
Ethereum
)
{
wslogger
.
Infoln
(
"Starting WebSockets"
)
sock
:=
NewWebSocketServer
(
eth
)
go
sock
.
Serv
()
}
// TODO This is starting to become a generic method. Move to utils
// TODO This is starting to become a generic method. Move to utils
func
mapToTxParams
(
object
map
[
string
]
interface
{})
map
[
string
]
string
{
func
mapToTxParams
(
object
map
[
string
]
interface
{})
map
[
string
]
string
{
// Default values
// Default values
...
...
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