@@ -14,26 +14,14 @@ import (
14
14
"google.golang.org/grpc/status"
15
15
16
16
"go.viam.com/rdk/resource"
17
+ "go.viam.com/rdk/robot"
17
18
"go.viam.com/rdk/session"
18
19
)
19
20
20
21
type ctxKey byte
21
22
22
23
const ctxKeyInSessionMDReq = ctxKey (iota )
23
24
24
- var exemptFromSession = map [string ]bool {
25
- "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" : true ,
26
- "/proto.rpc.webrtc.v1.SignalingService/Call" : true ,
27
- "/proto.rpc.webrtc.v1.SignalingService/CallUpdate" : true ,
28
- "/proto.rpc.webrtc.v1.SignalingService/OptionalWebRTCConfig" : true ,
29
- "/proto.rpc.v1.AuthService/Authenticate" : true ,
30
- "/proto.rpc.v1.ExternalAuthService/AuthenticateTo" : true ,
31
- "/viam.robot.v1.RobotService/ResourceNames" : true ,
32
- "/viam.robot.v1.RobotService/ResourceRPCSubtypes" : true ,
33
- "/viam.robot.v1.RobotService/StartSession" : true ,
34
- "/viam.robot.v1.RobotService/SendSessionHeartbeat" : true ,
35
- }
36
-
37
25
func (rc * RobotClient ) sessionReset () {
38
26
rc .sessionMu .Lock ()
39
27
rc .sessionsSupported = nil
@@ -102,7 +90,7 @@ func (rc *RobotClient) sessionMetadata(ctx context.Context, method string) (cont
102
90
return rc .sessionMetadataInner (ctx ), nil
103
91
}
104
92
rc .sessionMu .RUnlock ()
105
-
93
+ // upgrade lock
106
94
rc .sessionMu .Lock ()
107
95
defer rc .sessionMu .Unlock ()
108
96
@@ -166,7 +154,7 @@ func (rc *RobotClient) safetyMonitorFromHeaders(ctx context.Context, hdr metadat
166
154
}
167
155
168
156
func (rc * RobotClient ) useSessionInRequest (ctx context.Context , method string ) bool {
169
- return ! rc .sessionsDisabled && ! exemptFromSession [ method ] && ctx .Value (ctxKeyInSessionMDReq ) == nil
157
+ return ! rc .sessionsDisabled && ctx .Value (ctxKeyInSessionMDReq ) == nil && robot . IsSafetyHeartbeatMonitored ( method )
170
158
}
171
159
172
160
func (rc * RobotClient ) sessionUnaryClientInterceptor (
0 commit comments