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
158efbaa
Commit
158efbaa
authored
May 15, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #984 from tgerring/issue924
Omit replies for RPC notification requests
parents
3ac34ee3
44a7f997
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
http.go
rpc/http.go
+21
-3
No files found.
rpc/http.go
View file @
158efbaa
...
...
@@ -87,7 +87,9 @@ func JSONRPC(pipe *xeth.XEth) http.Handler {
var
reqSingle
RpcRequest
if
err
:=
json
.
Unmarshal
(
body
,
&
reqSingle
);
err
==
nil
{
response
:=
RpcResponse
(
api
,
&
reqSingle
)
send
(
w
,
&
response
)
if
reqSingle
.
Id
!=
nil
{
send
(
w
,
&
response
)
}
return
}
...
...
@@ -96,11 +98,27 @@ func JSONRPC(pipe *xeth.XEth) http.Handler {
if
err
:=
json
.
Unmarshal
(
body
,
&
reqBatch
);
err
==
nil
{
// Build response batch
resBatch
:=
make
([]
*
interface
{},
len
(
reqBatch
))
resCount
:=
0
for
i
,
request
:=
range
reqBatch
{
response
:=
RpcResponse
(
api
,
&
request
)
resBatch
[
i
]
=
response
// this leaves nil entries in the response batch for later removal
if
request
.
Id
!=
nil
{
resBatch
[
i
]
=
response
resCount
=
resCount
+
1
}
}
send
(
w
,
resBatch
)
// make response omitting nil entries
respBatchComp
:=
make
([]
*
interface
{},
resCount
)
for
_
,
v
:=
range
resBatch
{
if
v
!=
nil
{
respBatchComp
[
len
(
respBatchComp
)
-
resCount
]
=
v
resCount
=
resCount
-
1
}
}
send
(
w
,
respBatchComp
)
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