Skip to content

Commit c1a94d3

Browse files
author
Mateusz
committed
fix: scope executor secure-session lock
1 parent d112be8 commit c1a94d3

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

internal/core/runtime/executor.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ var _ lipsdk.ExecutorView = (*Executor)(nil)
3434
// internal/core/runtime test binary links export_test.go, which assigns this hook in init.
3535
var secureSessionTestPrepare = func(*Executor) {}
3636

37-
// secureSessionMu guards lazy initialization of Executor.SecureSession in tests.
38-
var secureSessionMu sync.Mutex
39-
4037
// Executor orchestrates hooks, capability negotiation, routing, B2BUA, and backend attempts.
4138
type Executor struct {
4239
Store b2bua.Store
@@ -80,6 +77,8 @@ type Executor struct {
8077
ExtensionMetrics extensions.StageMetrics
8178
// CompletionBufferLimits overrides completion-gate buffering bounds (tests). Zero MaxEvents uses SDK defaults.
8279
CompletionBufferLimits completion.BufferLimits
80+
// secureSessionMu guards lazy initialization of SecureSession in the test hook path.
81+
secureSessionMu sync.Mutex
8382

8483
// SecureSession authorizes turns via BeginTurn before submit hooks; required for all executor prepares.
8584
SecureSession *app.Manager
@@ -149,11 +148,11 @@ func (e *Executor) Execute(ctx context.Context, call *lipapi.Call) (_ lipapi.Eve
149148
if e.RuntimeSnapshot != nil {
150149
ctx = extensions.WithRequestRuntimeSnapshot(ctx, e.RuntimeSnapshot)
151150
}
152-
secureSessionMu.Lock()
151+
e.secureSessionMu.Lock()
152+
defer e.secureSessionMu.Unlock()
153153
if e.SecureSession == nil {
154154
secureSessionTestPrepare(e)
155155
}
156-
secureSessionMu.Unlock()
157156
if e.SecureSession == nil {
158157
return nil, fmt.Errorf("executor: secure session manager is required")
159158
}

0 commit comments

Comments
 (0)