Skip to content

Commit

Permalink
backport of commit 270f040
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Oct 6, 2023
1 parent fc0d434 commit a2c106e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
* cli: Fix issue when using the `authenticate` command against a password auth
method on Windows where the password would be swallowed when the login name is
submitted ([PR](https://github.com/hashicorp/boundary/pull/3800))
* worker: Fix an issue that could cause intermittent startup issues on slow
systems ([PR](https://github.com/hashicorp/boundary/pull/3803))

## 0.13.1 (2023/07/10)

Expand Down
10 changes: 5 additions & 5 deletions internal/daemon/worker/controller_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ func (w *Worker) upstreamDialerFunc(extraAlpnProtos ...string) func(context.Cont
default:
// In this case, event, so that the operator can understand that
// it was rejected
event.WriteError(ctx, op, fmt.Errorf("controller rejected activation token as invalid"))
event.WriteError(w.baseContext, op, fmt.Errorf("controller rejected activation token as invalid"))
return nil, errors.Wrap(w.baseContext, err, op)
}

default:
event.WriteError(ctx, op, err)
event.WriteError(w.baseContext, op, err)
return nil, errors.Wrap(w.baseContext, err, op)
}

Expand All @@ -176,7 +176,7 @@ func (w *Worker) upstreamDialerFunc(extraAlpnProtos ...string) func(context.Cont
w.everAuthenticated.Store(authenticationStatusFirstAuthentication)
}

event.WriteSysEvent(ctx, op, "worker has successfully authenticated")
event.WriteSysEvent(w.baseContext, op, "worker has successfully authenticated")
}

return conn, err
Expand Down Expand Up @@ -204,13 +204,13 @@ func (w *Worker) v1KmsAuthDialFn(ctx context.Context, addr string, extraAlpnProt
written, err := tlsConn.Write([]byte(authInfo.ConnectionNonce))
if err != nil {
if err := nonTlsConn.Close(); err != nil {
event.WriteError(ctx, op, err, event.WithInfoMsg("error closing connection after writing failure"))
event.WriteError(w.baseContext, op, err, event.WithInfoMsg("error closing connection after writing failure"))
}
return nil, fmt.Errorf("unable to write connection nonce: %w", err)
}
if written != len(authInfo.ConnectionNonce) {
if err := nonTlsConn.Close(); err != nil {
event.WriteError(ctx, op, err, event.WithInfoMsg("error closing connection after writing failure"))
event.WriteError(w.baseContext, op, err, event.WithInfoMsg("error closing connection after writing failure"))
}
return nil, fmt.Errorf("expected to write %d bytes of connection nonce, wrote %d", len(authInfo.ConnectionNonce), written)
}
Expand Down

0 comments on commit a2c106e

Please sign in to comment.