Do nog log error when EOS is being written on an EOF socket
This commit is contained in:
parent
e1bb4d7379
commit
f3b723ca44
@ -300,17 +300,21 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
|
|||||||
defer psock.Close()
|
defer psock.Close()
|
||||||
|
|
||||||
// serve the actual request using the request router
|
// serve the actual request using the request router
|
||||||
if err := r.ServeRequest(ctx, request, response); err != nil {
|
if serveRequestError := r.ServeRequest(ctx, request, response); serveRequestError != nil {
|
||||||
// write an error response
|
// write an error response
|
||||||
err = rcodec.Write(&codec.Message{
|
writeError := rcodec.Write(&codec.Message{
|
||||||
Header: msg.Header,
|
Header: msg.Header,
|
||||||
Error: err.Error(),
|
Error: serveRequestError.Error(),
|
||||||
Type: codec.Error,
|
Type: codec.Error,
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
// could not write the error response
|
// if the server request is an EOS error we let the socket know
|
||||||
if err != nil {
|
// sometimes the socket is already closed on the other side, so we can ignore that error
|
||||||
log.Logf("rpc: unable to write error response: %v", err)
|
alreadyClosed := serveRequestError == lastStreamResponseError && writeError == io.EOF
|
||||||
|
|
||||||
|
// could not write error response
|
||||||
|
if writeError != nil && !alreadyClosed {
|
||||||
|
log.Logf("rpc: unable to write error response: %v", writeError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user