Skip to content

Commit c97831a

Browse files
Send command handler status for session validation.
Signed-off-by: Raveendra Karu <r.karu@samsung.com>
1 parent 524e87c commit c97831a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/app/clusters/webrtc-transport-requestor-server/webrtc-transport-requestor-server.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,13 @@ bool WebRTCTransportRequestorServer::IsPeerNodeSessionValid(uint16_t sessionId,
181181

182182
if (!existingSession)
183183
{
184-
// If sessionId is not null and does not match a value in current sessions.
185-
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
186184
return false;
187185
}
188186

189187
// Also check that the existing session belongs to the same PeerNodeID / Fabric
190-
// If it doesn’t match, respond with CONSTRAINT_ERROR
188+
// If it doesn’t match, return false
191189
if (peerNodeId != existingSession->peerNodeID || peerFabricIndex != existingSession->GetFabricIndex())
192190
{
193-
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
194191
return false;
195192
}
196193

@@ -333,8 +330,10 @@ void WebRTCTransportRequestorServer::HandleICECandidates(HandlerContext & ctx, c
333330

334331
// Check if the session, NodeID are valid
335332
if (!IsPeerNodeSessionValid(sessionId, ctx))
333+
{
334+
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::NotFound);
336335
return;
337-
336+
}
338337
// Handle ICE candidates in Delegate
339338
ctx.mCommandHandler.AddStatus(
340339
ctx.mRequestPath, Protocols::InteractionModel::ClusterStatusCode(mDelegate.HandleICECandidates(sessionId, candidates)));
@@ -356,8 +355,10 @@ void WebRTCTransportRequestorServer::HandleEnd(HandlerContext & ctx, const Comma
356355

357356
// Check if the session, NodeID are valid
358357
if (!IsPeerNodeSessionValid(sessionId, ctx))
358+
{
359+
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::NotFound);
359360
return;
360-
361+
}
361362
// Handle End command in Delegate
362363
ctx.mCommandHandler.AddStatus(ctx.mRequestPath,
363364
Protocols::InteractionModel::ClusterStatusCode(mDelegate.HandleEnd(sessionId, reason)));

0 commit comments

Comments
 (0)