@@ -26,6 +26,7 @@ import (
2626 "github.com/ethereum/go-ethereum/logger/glog"
2727 "github.com/ethereum/go-ethereum/rpc/codec"
2828 "github.com/ethereum/go-ethereum/rpc/shared"
29+ "github.com/ethereum/go-ethereum/rpc/useragent"
2930)
3031
3132func newIpcClient (cfg IpcConfig , codec codec.Codec ) (* ipcClient , error ) {
@@ -34,14 +35,34 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) {
3435 return nil , err
3536 }
3637
37- return & ipcClient {cfg .Endpoint , c , codec , codec .New (c )}, nil
38+ coder := codec .New (c )
39+ msg := shared.Request {
40+ Id : 0 ,
41+ Method : useragent .EnableUserAgentMethod ,
42+ Jsonrpc : shared .JsonRpcVersion ,
43+ Params : []byte ("[]" ),
44+ }
45+
46+ coder .WriteResponse (msg )
47+ coder .Recv ()
48+
49+ return & ipcClient {cfg .Endpoint , c , codec , coder }, nil
3850}
3951
4052func (self * ipcClient ) reconnect () error {
4153 self .coder .Close ()
4254 c , err := net .DialUnix ("unix" , nil , & net.UnixAddr {self .endpoint , "unix" })
4355 if err == nil {
4456 self .coder = self .codec .New (c )
57+
58+ msg := shared.Request {
59+ Id : 0 ,
60+ Method : useragent .EnableUserAgentMethod ,
61+ Jsonrpc : shared .JsonRpcVersion ,
62+ Params : []byte ("[]" ),
63+ }
64+ self .coder .WriteResponse (msg )
65+ self .coder .Recv ()
4566 }
4667
4768 return err
0 commit comments