diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-25 23:06:19 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-25 23:06:19 +0800 |
commit | e64625aa8215985c85f97f914a98db081e07714f (patch) | |
tree | d452551dccb6728ab96d849cd485b7220268c388 /rpc/comms/ipc_windows.go | |
parent | 6b2a03faa2473d38093adbeee62935af2fe2da59 (diff) | |
parent | 662285074e55a3915f7236a04fec355c3f416eb8 (diff) | |
download | go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.tar go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.tar.gz go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.tar.bz2 go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.tar.lz go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.tar.xz go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.tar.zst go-tangerine-e64625aa8215985c85f97f914a98db081e07714f.zip |
Merge pull request #1332 from bas-vk/ipcbatch
IPC interface improvements
Diffstat (limited to 'rpc/comms/ipc_windows.go')
-rw-r--r-- | rpc/comms/ipc_windows.go | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/rpc/comms/ipc_windows.go b/rpc/comms/ipc_windows.go index 44c82ef8a..203cd2d7b 100644 --- a/rpc/comms/ipc_windows.go +++ b/rpc/comms/ipc_windows.go @@ -640,7 +640,7 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { return nil, err } - return &ipcClient{cfg.Endpoint, codec, codec.New(c)}, nil + return &ipcClient{cfg.Endpoint, c, codec, codec.New(c)}, nil } func (self *ipcClient) reconnect() error { @@ -668,33 +668,13 @@ func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { continue } - go func(conn net.Conn) { - codec := codec.New(conn) - - for { - req, err := codec.ReadRequest() - if err == io.EOF { - codec.Close() - return - } else if err != nil { - glog.V(logger.Error).Infof("IPC recv err - %v\n", err) - codec.Close() - return - } - - var rpcResponse interface{} - res, err := api.Execute(req) - - rpcResponse = shared.NewRpcResponse(req.Id, req.Jsonrpc, res, err) - err = codec.WriteResponse(rpcResponse) - if err != nil { - glog.V(logger.Error).Infof("IPC send err - %v\n", err) - codec.Close() - return - } - } - }(conn) + id := newIpcConnId() + glog.V(logger.Debug).Infof("New IPC connection with id %06d started\n", id) + + go handle(id, conn, api, codec) } + + os.Remove(cfg.Endpoint) }() glog.V(logger.Info).Infof("IPC service started (%s)\n", cfg.Endpoint) |