Skip to content

Commit 3655d07

Browse files
authored
Close conn on WriteResponse errors and add Nomad to CODEOWNERS (#26)
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.
1 parent bc22f4e commit 3655d07

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# More on CODEOWNERS files: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
33

44
# Default owner
5-
* @hashicorp/team-ip-compliance
5+
* @hashicorp/team-ip-compliance @hashicorp/nomad-eng
66

77
# Add override rules below. Each line is a file/folder pattern followed by one or more owners.
88
# Being an owner means those groups or individuals will be added as reviewers to PRs affecting
99
# those areas of the code.
1010
# Examples:
1111
# /docs/ @docs-team
1212
# *.js @js-team
13-
# *.go @go-team
13+
# *.go @go-team

codec/rpc.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,13 @@ func (c *goRpcCodec) WriteRequest(r *rpc.Request, body interface{}) error {
162162
}
163163

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

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

0 commit comments

Comments
 (0)