@@ -1071,8 +1071,8 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
1071
1071
defer a .connCountReconnectingPTY .Add (- 1 )
1072
1072
1073
1073
connectionID := uuid .NewString ()
1074
- logger = logger .With (slog .F ("message_id" ,msg .ID ),slog .F ("connection_id" ,connectionID ))
1075
- logger .Debug (ctx ,"starting handler" )
1074
+ connLogger : =logger .With (slog .F ("message_id" ,msg .ID ),slog .F ("connection_id" ,connectionID ))
1075
+ connLogger .Debug (ctx ,"starting handler" )
1076
1076
1077
1077
defer func () {
1078
1078
if err := retErr ;err != nil {
@@ -1083,12 +1083,12 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
1083
1083
// If the agent is closed, we don't want to
1084
1084
// log this as an error since it's expected.
1085
1085
if closed {
1086
- logger .Debug (ctx ,"reconnecting pty failed with attach error (agent closed)" ,slog .Error (err ))
1086
+ connLogger .Debug (ctx ,"reconnecting pty failed with attach error (agent closed)" ,slog .Error (err ))
1087
1087
}else {
1088
- logger .Error (ctx ,"reconnecting pty failed with attach error" ,slog .Error (err ))
1088
+ connLogger .Error (ctx ,"reconnecting pty failed with attach error" ,slog .Error (err ))
1089
1089
}
1090
1090
}
1091
- logger .Debug (ctx ,"reconnecting pty connection closed" )
1091
+ connLogger .Debug (ctx ,"reconnecting pty connection closed" )
1092
1092
}()
1093
1093
1094
1094
var rpty reconnectingpty.ReconnectingPTY
@@ -1097,7 +1097,7 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
1097
1097
waitReady ,ok := a .reconnectingPTYs .LoadOrStore (msg .ID ,sendConnected )
1098
1098
if ok {
1099
1099
close (sendConnected )// Unused.
1100
- logger .Debug (ctx ,"connecting to existing reconnecting pty" )
1100
+ connLogger .Debug (ctx ,"connecting to existing reconnecting pty" )
1101
1101
c ,ok := waitReady .(chan reconnectingpty.ReconnectingPTY )
1102
1102
if ! ok {
1103
1103
return xerrors .Errorf ("found invalid type in reconnecting pty map: %T" ,waitReady )
@@ -1108,7 +1108,7 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
1108
1108
}
1109
1109
c <- rpty // Put it back for the next reconnect.
1110
1110
}else {
1111
- logger .Debug (ctx ,"creating new reconnecting pty" )
1111
+ connLogger .Debug (ctx ,"creating new reconnecting pty" )
1112
1112
1113
1113
connected := false
1114
1114
defer func () {
@@ -1141,7 +1141,7 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
1141
1141
connected = true
1142
1142
sendConnected <- rpty
1143
1143
}
1144
- return rpty .Attach (ctx ,connectionID ,conn ,msg .Height ,msg .Width ,logger )
1144
+ return rpty .Attach (ctx ,connectionID ,conn ,msg .Height ,msg .Width ,connLogger )
1145
1145
}
1146
1146
1147
1147
// startReportingConnectionStats runs the connection stats reporting goroutine.