Skip to content

Commit

Permalink
serve: remove deadcode
Browse files Browse the repository at this point in the history
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Mar 22, 2022
1 parent 050d18c commit 8c68d4f
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ package jsonrpc2

import (
"context"
"errors"
"fmt"
"io"
"net"
"os"
"time"
Expand Down Expand Up @@ -129,23 +127,3 @@ func Serve(ctx context.Context, ln net.Listener, server StreamServer, idleTimeou
}
}
}

// isClosingError reports whether the error occurs normally during the process of
// closing a network connection.
//
// It uses imperfect heuristics that err on the side of false negatives,
// and should not be used for anything critical.
func isClosingError(err error) bool {
if errors.Is(err, io.EOF) {
return true
}

// Per https://github.com/golang/go/issues/4373, this error string should not
// change. This is not ideal, but since the worst that could happen here is
// some superfluous logging, it is acceptable.
if err.Error() == "use of closed network connection" {
return true
}

return false
}

0 comments on commit 8c68d4f

Please sign in to comment.