Skip to content

Commit

Permalink
Close conn on WriteResponse errors and add Nomad to CODEOWNERS (#26)
Browse files Browse the repository at this point in the history
Port the fix from hashicorp/net-rpc-msgpackrpc#15

**For consistency only.** To the best of my knowledge no HashiCorp tools use this code. They only use the serialization code from this package and all use hashicorp/net-rpc-msgpackrpc for RPC.

Also add @hashicorp/nomad-eng to CODEOWNERS as in hashicorp/go-sockaddr#75

Team will also need repo write access.
  • Loading branch information
schmichael authored Feb 20, 2025
1 parent bc22f4e commit 3655d07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# More on CODEOWNERS files: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

# Default owner
* @hashicorp/team-ip-compliance
* @hashicorp/team-ip-compliance @hashicorp/nomad-eng

# Add override rules below. Each line is a file/folder pattern followed by one or more owners.
# Being an owner means those groups or individuals will be added as reviewers to PRs affecting
# those areas of the code.
# Examples:
# /docs/ @docs-team
# *.js @js-team
# *.go @go-team
# *.go @go-team
8 changes: 7 additions & 1 deletion codec/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ func (c *goRpcCodec) WriteRequest(r *rpc.Request, body interface{}) error {
}

func (c *goRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error {
return c.write(r, body, true)
err := c.write(r, body, true)
if err != nil {
// If error occurred writing a response, close the underlying connection.
// See hashicorp/net-rpc-msgpackrpc#15
c.Close()
}
return err
}

func (c *goRpcCodec) ReadResponseHeader(r *rpc.Response) error {
Expand Down

0 comments on commit 3655d07

Please sign in to comment.