aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/comms/ipc_unix.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-08-24 18:22:12 +0800
committerBas van Kervel <bas@ethdev.com>2015-08-24 18:41:34 +0800
commitd910148a96cca05bc40ac5b5773effa9b92702f8 (patch)
tree8d7d177b1d4ef721c7036076c533402308f5fe86 /rpc/comms/ipc_unix.go
parentd51d0022cee91d6588186455afbe6e54fae2cbf7 (diff)
downloaddexon-d910148a96cca05bc40ac5b5773effa9b92702f8.tar
dexon-d910148a96cca05bc40ac5b5773effa9b92702f8.tar.gz
dexon-d910148a96cca05bc40ac5b5773effa9b92702f8.tar.bz2
dexon-d910148a96cca05bc40ac5b5773effa9b92702f8.tar.lz
dexon-d910148a96cca05bc40ac5b5773effa9b92702f8.tar.xz
dexon-d910148a96cca05bc40ac5b5773effa9b92702f8.tar.zst
dexon-d910148a96cca05bc40ac5b5773effa9b92702f8.zip
Set ipc channel as user agent client
Diffstat (limited to 'rpc/comms/ipc_unix.go')
-rw-r--r--rpc/comms/ipc_unix.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go
index 24aefa5f3..9d90da071 100644
--- a/rpc/comms/ipc_unix.go
+++ b/rpc/comms/ipc_unix.go
@@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
+ "github.com/ethereum/go-ethereum/rpc/useragent"
)
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 &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 {
@@ -42,6 +54,15 @@ func (self *ipcClient) reconnect() error {
c, err := net.DialUnix("unix", nil, &net.UnixAddr{self.endpoint, "unix"})
if err == nil {
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