Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
serve: remove deadcode
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Mar 22, 2022
commit 8c68d4fd37cd4bd06b62b3243f0d2292c681d164
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
}