|
|
@ -44,12 +44,14 @@ func (self *ipcClient) Close() { |
|
|
|
|
|
|
|
|
|
|
|
func (self *ipcClient) Send(req interface{}) error { |
|
|
|
func (self *ipcClient) Send(req interface{}) error { |
|
|
|
var err error |
|
|
|
var err error |
|
|
|
if err = self.coder.WriteResponse(req); err != nil { |
|
|
|
if r, ok := req.(*shared.Request); ok { |
|
|
|
if _, ok := err.(*net.OpError); ok { // connection lost, retry once
|
|
|
|
if err = self.coder.WriteResponse(r); err != nil { |
|
|
|
if err = self.reconnect(); err == nil { |
|
|
|
if err = self.reconnect(); err == nil { |
|
|
|
err = self.coder.WriteResponse(req) |
|
|
|
err = self.coder.WriteResponse(r) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|