Merge pull request #413 from qkzsky/qkzsky-rpc-fix
client close: rpc: unable to write error response
This commit is contained in:
commit
686171c26d
@ -157,15 +157,17 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
|
|||||||
|
|
||||||
// TODO: handle error better
|
// TODO: handle error better
|
||||||
if err := handler(ctx, request, response); err != nil {
|
if err := handler(ctx, request, response); err != nil {
|
||||||
// write an error response
|
if err != lastStreamResponseError {
|
||||||
err = rcodec.Write(&codec.Message{
|
// write an error response
|
||||||
Header: msg.Header,
|
err = rcodec.Write(&codec.Message{
|
||||||
Error: err.Error(),
|
Header: msg.Header,
|
||||||
Type: codec.Error,
|
Error: err.Error(),
|
||||||
}, nil)
|
Type: codec.Error,
|
||||||
// could not write the error response
|
}, nil)
|
||||||
if err != nil {
|
// could not write the error response
|
||||||
log.Logf("rpc: unable to write error response: %v", err)
|
if err != nil {
|
||||||
|
log.Logf("rpc: unable to write error response: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s.wg.Done()
|
s.wg.Done()
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user