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
a219159e
Commit
a219159e
authored
Aug 25, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1710 from bas-vk/useragent
user agent messages were dumped in some cases
parents
d51d0022
d910148a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
20 deletions
+48
-20
ipc.go
rpc/comms/ipc.go
+4
-8
ipc_unix.go
rpc/comms/ipc_unix.go
+22
-1
ipc_windows.go
rpc/comms/ipc_windows.go
+22
-1
jeth.go
rpc/jeth.go
+0
-10
No files found.
rpc/comms/ipc.go
View file @
a219159e
...
@@ -42,17 +42,13 @@ func (self *ipcClient) Close() {
...
@@ -42,17 +42,13 @@ func (self *ipcClient) Close() {
self
.
coder
.
Close
()
self
.
coder
.
Close
()
}
}
func
(
self
*
ipcClient
)
Send
(
req
interface
{})
error
{
func
(
self
*
ipcClient
)
Send
(
msg
interface
{})
error
{
var
err
error
var
err
error
if
r
,
ok
:=
req
.
(
*
shared
.
Request
);
ok
{
if
err
=
self
.
coder
.
WriteResponse
(
msg
);
err
!=
nil
{
if
err
=
self
.
coder
.
WriteResponse
(
r
);
err
!=
nil
{
if
err
=
self
.
reconnect
();
err
==
nil
{
if
err
=
self
.
reconnect
();
err
==
nil
{
err
=
self
.
coder
.
WriteResponse
(
r
)
err
=
self
.
coder
.
WriteResponse
(
msg
)
}
}
}
}
return
err
}
return
err
return
err
}
}
...
...
rpc/comms/ipc_unix.go
View file @
a219159e
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/useragent"
)
)
func
newIpcClient
(
cfg
IpcConfig
,
codec
codec
.
Codec
)
(
*
ipcClient
,
error
)
{
func
newIpcClient
(
cfg
IpcConfig
,
codec
codec
.
Codec
)
(
*
ipcClient
,
error
)
{
...
@@ -34,7 +35,18 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) {
...
@@ -34,7 +35,18 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) {
return
nil
,
err
return
nil
,
err
}
}
return
&
ipcClient
{
cfg
.
Endpoint
,
c
,
codec
,
codec
.
New
(
c
)},
nil
coder
:=
codec
.
New
(
c
)
msg
:=
shared
.
Request
{
Id
:
0
,
Method
:
useragent
.
EnableUserAgentMethod
,
Jsonrpc
:
shared
.
JsonRpcVersion
,
Params
:
[]
byte
(
"[]"
),
}
coder
.
WriteResponse
(
msg
)
coder
.
Recv
()
return
&
ipcClient
{
cfg
.
Endpoint
,
c
,
codec
,
coder
},
nil
}
}
func
(
self
*
ipcClient
)
reconnect
()
error
{
func
(
self
*
ipcClient
)
reconnect
()
error
{
...
@@ -42,6 +54,15 @@ func (self *ipcClient) reconnect() error {
...
@@ -42,6 +54,15 @@ func (self *ipcClient) reconnect() error {
c
,
err
:=
net
.
DialUnix
(
"unix"
,
nil
,
&
net
.
UnixAddr
{
self
.
endpoint
,
"unix"
})
c
,
err
:=
net
.
DialUnix
(
"unix"
,
nil
,
&
net
.
UnixAddr
{
self
.
endpoint
,
"unix"
})
if
err
==
nil
{
if
err
==
nil
{
self
.
coder
=
self
.
codec
.
New
(
c
)
self
.
coder
=
self
.
codec
.
New
(
c
)
msg
:=
shared
.
Request
{
Id
:
0
,
Method
:
useragent
.
EnableUserAgentMethod
,
Jsonrpc
:
shared
.
JsonRpcVersion
,
Params
:
[]
byte
(
"[]"
),
}
self
.
coder
.
WriteResponse
(
msg
)
self
.
coder
.
Recv
()
}
}
return
err
return
err
...
...
rpc/comms/ipc_windows.go
View file @
a219159e
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/ethereum/go-ethereum/rpc/useragent"
)
)
var
(
var
(
...
@@ -656,13 +657,33 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) {
...
@@ -656,13 +657,33 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) {
return
nil
,
err
return
nil
,
err
}
}
return
&
ipcClient
{
cfg
.
Endpoint
,
c
,
codec
,
codec
.
New
(
c
)},
nil
coder
:=
codec
.
New
(
c
)
msg
:=
shared
.
Request
{
Id
:
0
,
Method
:
useragent
.
EnableUserAgentMethod
,
Jsonrpc
:
shared
.
JsonRpcVersion
,
Params
:
[]
byte
(
"[]"
),
}
coder
.
WriteResponse
(
msg
)
coder
.
Recv
()
return
&
ipcClient
{
cfg
.
Endpoint
,
c
,
codec
,
coder
},
nil
}
}
func
(
self
*
ipcClient
)
reconnect
()
error
{
func
(
self
*
ipcClient
)
reconnect
()
error
{
c
,
err
:=
Dial
(
self
.
endpoint
)
c
,
err
:=
Dial
(
self
.
endpoint
)
if
err
==
nil
{
if
err
==
nil
{
self
.
coder
=
self
.
codec
.
New
(
c
)
self
.
coder
=
self
.
codec
.
New
(
c
)
req
:=
shared
.
Request
{
Id
:
0
,
Method
:
useragent
.
EnableUserAgentMethod
,
Jsonrpc
:
shared
.
JsonRpcVersion
,
Params
:
[]
byte
(
"[]"
),
}
self
.
coder
.
WriteResponse
(
req
)
self
.
coder
.
Recv
()
}
}
return
err
return
err
}
}
...
...
rpc/jeth.go
View file @
a219159e
...
@@ -40,16 +40,6 @@ type Jeth struct {
...
@@ -40,16 +40,6 @@ type Jeth struct {
}
}
func
NewJeth
(
ethApi
shared
.
EthereumApi
,
re
*
jsre
.
JSRE
,
client
comms
.
EthereumClient
,
fe
xeth
.
Frontend
)
*
Jeth
{
func
NewJeth
(
ethApi
shared
.
EthereumApi
,
re
*
jsre
.
JSRE
,
client
comms
.
EthereumClient
,
fe
xeth
.
Frontend
)
*
Jeth
{
// enable the jeth as the user agent
req
:=
shared
.
Request
{
Id
:
0
,
Method
:
useragent
.
EnableUserAgentMethod
,
Jsonrpc
:
shared
.
JsonRpcVersion
,
Params
:
[]
byte
(
"[]"
),
}
client
.
Send
(
&
req
)
client
.
Recv
()
return
&
Jeth
{
ethApi
,
re
,
client
,
fe
}
return
&
Jeth
{
ethApi
,
re
,
client
,
fe
}
}
}
...
...
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