diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-20 04:29:51 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-20 04:29:51 +0800 |
commit | bd3a44cac9664ff72584fb123b3348f24c62d066 (patch) | |
tree | 6968700dd4b1b213db49d76aafce312a6a490b94 /rpc/comms | |
parent | 61a6911eebfac5c70959227a8fe0a4e9c2ef5c61 (diff) | |
parent | 9bf17eb05a4591d8dec9779a9efddc5c2276699a (diff) | |
download | go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.tar go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.tar.gz go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.tar.bz2 go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.tar.lz go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.tar.xz go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.tar.zst go-tangerine-bd3a44cac9664ff72584fb123b3348f24c62d066.zip |
Merge pull request #1652 from bas-vk/autoreconnect
rpc/comms: reconnect ipc client after write error
Diffstat (limited to 'rpc/comms')
-rw-r--r-- | rpc/comms/ipc.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go index e982ada13..d897bf313 100644 --- a/rpc/comms/ipc.go +++ b/rpc/comms/ipc.go @@ -44,12 +44,14 @@ func (self *ipcClient) Close() { func (self *ipcClient) Send(req interface{}) error { var err error - if err = self.coder.WriteResponse(req); err != nil { - if _, ok := err.(*net.OpError); ok { // connection lost, retry once + if r, ok := req.(*shared.Request); ok { + if err = self.coder.WriteResponse(r); err != nil { if err = self.reconnect(); err == nil { - err = self.coder.WriteResponse(req) + err = self.coder.WriteResponse(r) } } + + return err } return err } |