Merge pull request #487 from lpxxn/master

fix streamming error io.ErrUnexpectedEOF
This commit is contained in:
Asim Aslam 2019-05-27 09:29:48 +01:00 committed by GitHub
commit e035664a8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,17 +157,15 @@ 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 {
if err != lastStreamResponseError { // write an error response
// write an error response err = rcodec.Write(&codec.Message{
err = rcodec.Write(&codec.Message{ Header: msg.Header,
Header: msg.Header, Error: err.Error(),
Error: err.Error(), Type: codec.Error,
Type: codec.Error, }, nil)
}, nil) // could not write the error response
// could not write the error response if err != nil {
if err != nil { log.Logf("rpc: unable to write error response: %v", err)
log.Logf("rpc: unable to write error response: %v", err)
}
} }
s.wg.Done() s.wg.Done()
return return