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
e9d017ba
Commit
e9d017ba
authored
Jan 27, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename api var for clarity
parent
d8c6168d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
server.go
rpc/http/server.go
+2
-2
server.go
rpc/ws/server.go
+4
-5
No files found.
rpc/http/server.go
View file @
e9d017ba
...
...
@@ -83,7 +83,7 @@ func (s *RpcHttpServer) Start() {
}
}
func
(
s
*
RpcHttpServer
)
apiHandler
(
xeth
*
rpc
.
EthereumApi
)
http
.
Handler
{
func
(
s
*
RpcHttpServer
)
apiHandler
(
api
*
rpc
.
EthereumApi
)
http
.
Handler
{
fn
:=
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
rpchttplogger
.
Debugln
(
"Handling request"
)
...
...
@@ -94,7 +94,7 @@ func (s *RpcHttpServer) apiHandler(xeth *rpc.EthereumApi) http.Handler {
}
var
response
interface
{}
reserr
:=
xeth
.
GetRequestReply
(
&
reqParsed
,
&
response
)
reserr
:=
api
.
GetRequestReply
(
&
reqParsed
,
&
response
)
if
reserr
!=
nil
{
rpchttplogger
.
Errorln
(
reserr
)
JSON
.
Send
(
w
,
&
rpc
.
RpcErrorResponse
{
JsonRpc
:
reqParsed
.
JsonRpc
,
ID
:
reqParsed
.
ID
,
Error
:
true
,
ErrorText
:
reserr
.
Error
()})
...
...
rpc/ws/server.go
View file @
e9d017ba
...
...
@@ -85,9 +85,9 @@ func (self *WebSocketServer) Start() {
}
}
func
(
s
*
WebSocketServer
)
apiHandler
(
xeth
*
rpc
.
EthereumApi
)
http
.
Handler
{
func
(
s
*
WebSocketServer
)
apiHandler
(
api
*
rpc
.
EthereumApi
)
http
.
Handler
{
fn
:=
func
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
)
{
h
:=
sockHandler
(
xeth
)
h
:=
sockHandler
(
api
)
s
:=
websocket
.
Server
{
Handler
:
h
}
s
.
ServeHTTP
(
w
,
req
)
}
...
...
@@ -95,10 +95,9 @@ func (s *WebSocketServer) apiHandler(xeth *rpc.EthereumApi) http.Handler {
return
http
.
HandlerFunc
(
fn
)
}
func
sockHandler
(
xeth
*
rpc
.
EthereumApi
)
websocket
.
Handler
{
func
sockHandler
(
api
*
rpc
.
EthereumApi
)
websocket
.
Handler
{
fn
:=
func
(
conn
*
websocket
.
Conn
)
{
for
{
// FIX wslogger does not output to console
wslogger
.
Debugln
(
"Handling request"
)
var
reqParsed
rpc
.
RpcRequest
...
...
@@ -109,7 +108,7 @@ func sockHandler(xeth *rpc.EthereumApi) websocket.Handler {
}
var
response
interface
{}
reserr
:=
xeth
.
GetRequestReply
(
&
reqParsed
,
&
response
)
reserr
:=
api
.
GetRequestReply
(
&
reqParsed
,
&
response
)
if
reserr
!=
nil
{
wslogger
.
Errorln
(
reserr
)
websocket
.
JSON
.
Send
(
conn
,
rpc
.
RpcErrorResponse
{
JsonRpc
:
reqParsed
.
JsonRpc
,
ID
:
reqParsed
.
ID
,
Error
:
true
,
ErrorText
:
reserr
.
Error
()})
...
...
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