Add RLocks for all read access to s.connInfoMaps in a session (#2553)

* Add RLocks for all read access to s.connInfoMaps in a session
This commit is contained in:
Todd committed 2022-10-20 14:05:27 -07:00
1 parent 8af92997c8
commit 73f7004c74
2 files changed
+6

No files matched your search

+2
View File
@@ -16,6 +16,8 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
could be written to stdout along with a message that they could not
successfully be evented instead of being written to the event log
([PR](https://github.com/hashicorp/boundary/pull/2544))
* workers: Fixed a panic that can happen in certain situations
([PR](https://github.com/hashicorp/boundary/pull/2553))
## 0.11.0 (2022/09/27)
@@ -313,6 +313,8 @@ func (s *sess) RequestConnectConnection(ctx context.Context, info *pbs.ConnectCo
//
// The returned slice are connection ids that were closed.
func (s *sess) CancelOpenLocalConnections() []string {
s.lock.RLock()
defer s.lock.RUnlock()
var closedIds []string
for k, v := range s.connInfoMap {
if v.Status != pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_CLOSED {
@@ -336,6 +338,8 @@ func (s *sess) CancelOpenLocalConnections() []string {
//
// The returned slice is the connection ids which were closed.
func (s *sess) CancelAllLocalConnections() []string {
s.lock.RLock()
defer s.lock.RUnlock()
var closedIds []string
for k, v := range s.connInfoMap {
v.connCtxCancelFunc()