summaryrefslogtreecommitdiff
path: root/internal/server/handlers/sessioncommand.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/server/handlers/sessioncommand.go')
-rw-r--r--internal/server/handlers/sessioncommand.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/server/handlers/sessioncommand.go b/internal/server/handlers/sessioncommand.go
index 0d54963..25b8d15 100644
--- a/internal/server/handlers/sessioncommand.go
+++ b/internal/server/handlers/sessioncommand.go
@@ -140,6 +140,7 @@ func (s *sessionCommandState) start(handler *ServerHandler, spec session.Spec) (
s.spec = spec
s.cancel = cancel
s.mu.Unlock()
+ ctx = withSessionGeneration(ctx, 1)
handler.resetSessionAggregates()
if err := handler.dispatchSessionCommands(ctx, commands); err != nil {
@@ -172,6 +173,7 @@ func (s *sessionCommandState) update(handler *ServerHandler, spec session.Spec,
s.spec = spec
s.cancel = cancel
s.mu.Unlock()
+ ctx = withSessionGeneration(ctx, generation)
if oldCancel != nil {
oldCancel()
@@ -220,6 +222,12 @@ func (s *sessionCommandState) keepAlive() bool {
return s.active
}
+func (s *sessionCommandState) currentGeneration() uint64 {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ return s.generation
+}
+
func (s *sessionCommandState) reset() {
s.mu.Lock()
defer s.mu.Unlock()