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
5c654045
Commit
5c654045
authored
May 14, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Omit replies for notification requests
When Id is missing, the client does not want a response
parent
f7fdb4df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
http.go
rpc/http.go
+22
-3
No files found.
rpc/http.go
View file @
5c654045
...
@@ -87,7 +87,9 @@ func JSONRPC(pipe *xeth.XEth) http.Handler {
...
@@ -87,7 +87,9 @@ func JSONRPC(pipe *xeth.XEth) http.Handler {
var
reqSingle
RpcRequest
var
reqSingle
RpcRequest
if
err
:=
json
.
Unmarshal
(
body
,
&
reqSingle
);
err
==
nil
{
if
err
:=
json
.
Unmarshal
(
body
,
&
reqSingle
);
err
==
nil
{
response
:=
RpcResponse
(
api
,
&
reqSingle
)
response
:=
RpcResponse
(
api
,
&
reqSingle
)
if
reqSingle
.
Id
!=
nil
{
send
(
w
,
&
response
)
send
(
w
,
&
response
)
}
return
return
}
}
...
@@ -96,11 +98,28 @@ func JSONRPC(pipe *xeth.XEth) http.Handler {
...
@@ -96,11 +98,28 @@ func JSONRPC(pipe *xeth.XEth) http.Handler {
if
err
:=
json
.
Unmarshal
(
body
,
&
reqBatch
);
err
==
nil
{
if
err
:=
json
.
Unmarshal
(
body
,
&
reqBatch
);
err
==
nil
{
// Build response batch
// Build response batch
resBatch
:=
make
([]
*
interface
{},
len
(
reqBatch
))
resBatch
:=
make
([]
*
interface
{},
len
(
reqBatch
))
resCount
:=
0
for
i
,
request
:=
range
reqBatch
{
for
i
,
request
:=
range
reqBatch
{
response
:=
RpcResponse
(
api
,
&
request
)
response
:=
RpcResponse
(
api
,
&
request
)
// this leaves nil entries in the response batch for later removal
if
request
.
Id
!=
nil
{
resBatch
[
i
]
=
response
resBatch
[
i
]
=
response
resCount
=
resCount
+
1
}
}
send
(
w
,
resBatch
)
}
// make response omitting nil entries
respBatchComp
:=
make
([]
*
interface
{},
resCount
)
resCount
=
resCount
-
1
for
_
,
v
:=
range
resBatch
{
if
v
!=
nil
{
respBatchComp
[
resCount
]
=
v
resCount
=
resCount
-
1
}
}
send
(
w
,
respBatchComp
)
return
return
}
}
...
...
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