Skip to content

Commit

Permalink
relay: Rename relay-conn-inactive to relay-client-conn-inactive (#698)
Browse files Browse the repository at this point in the history
This error is emitted if the connection on which we receive a new call
is not in a valid state for a call (E.g., client connection is closing,
but it sends a new RPC).

Make this explicit by prefixing with "relay-client-" rather than
"relay-".
  • Loading branch information
prashantv authored Jun 25, 2018
1 parent a44ec2b commit a815a8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,9 @@ func (r *Relayer) handleCallReq(f lazyCallReq) error {
return nil
}

// Check that the current connection is in a valid state to handle a new call.
if canHandle, state := r.canHandleNewCall(); !canHandle {
call.Failed("relay-conn-inactive")
call.Failed("relay-client-conn-inactive")
call.End()
err := errConnNotActive{"incoming", state}
r.conn.SendSystemError(f.Header.ID, f.Span(), NewWrappedSystemError(ErrCodeDeclined, err))
Expand Down
4 changes: 2 additions & 2 deletions relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func TestRelayUsesRootPeers(t *testing.T) {
}

// Ensure that if the relay recieves a call on a connection that is not active,
// it declines the call, and increments a relay-conn-inactive stat.
// it declines the call, and increments a relay-client-conn-inactive stat.
func TestRelayRejectsDuringClose(t *testing.T) {
opts := testutils.NewOpts().SetRelayOnly().
AddLogFilter("Failed to relay frame.", 1, "error", "incoming connection is not active: connectionStartClose")
Expand Down Expand Up @@ -600,7 +600,7 @@ func TestRelayRejectsDuringClose(t *testing.T) {
Succeeded().End()
calls.Add(client.PeerInfo().ServiceName, ts.ServiceName(), "echo").
// No peer is set since we rejected the call before selecting one.
Failed("relay-conn-inactive").End()
Failed("relay-client-conn-inactive").End()
ts.AssertRelayStats(calls)
})
}
Expand Down

0 comments on commit a815a8e

Please sign in to comment.