Merge pull request #413 from qkzsky/qkzsky-rpc-fix

client close: rpc: unable to write error response
This commit is contained in:
Asim Aslam 2019-02-03 13:13:10 +00:00 committed by GitHub
commit 686171c26d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,6 +157,7 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
// TODO: handle error better
if err := handler(ctx, request, response); err != nil {
if err != lastStreamResponseError {
// write an error response
err = rcodec.Write(&codec.Message{
Header: msg.Header,
@ -167,6 +168,7 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
if err != nil {
log.Logf("rpc: unable to write error response: %v", err)
}
}
s.wg.Done()
return
}