Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure all commands with callbacks are parsed correctly #7315

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Message,
type MessageBaseOptions,
type MessageEncodingContext,
MessageOrigin,
type MessageParsingContext,
type MessageRaw,
MessageType,
Expand All @@ -32,7 +33,14 @@ export class AssignPriorityReturnRouteRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): AssignPriorityReturnRouteRequestBase {
return AssignPriorityReturnRouteRequestTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return AssignPriorityReturnRouteRequest.from(raw, ctx);
} else {
return AssignPriorityReturnRouteRequestTransmitReport.from(
raw,
ctx,
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Message,
type MessageBaseOptions,
type MessageEncodingContext,
MessageOrigin,
type MessageParsingContext,
type MessageRaw,
MessageType,
Expand All @@ -32,7 +33,14 @@ export class AssignPrioritySUCReturnRouteRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): AssignPrioritySUCReturnRouteRequestBase {
return AssignPrioritySUCReturnRouteRequestTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return AssignPrioritySUCReturnRouteRequest.from(raw, ctx);
} else {
return AssignPrioritySUCReturnRouteRequestTransmitReport.from(
raw,
ctx,
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedCallback,
expectedResponse,
Expand All @@ -32,7 +33,11 @@ export class AssignReturnRouteRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): AssignReturnRouteRequestBase {
return AssignReturnRouteRequestTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return AssignReturnRouteRequest.from(raw, ctx);
} else {
return AssignReturnRouteRequestTransmitReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedCallback,
expectedResponse,
Expand All @@ -32,7 +33,11 @@ export class DeleteReturnRouteRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): DeleteReturnRouteRequestBase {
return DeleteReturnRouteRequestTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return DeleteReturnRouteRequest.from(raw, ctx);
} else {
return DeleteReturnRouteRequestTransmitReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedCallback,
expectedResponse,
Expand Down Expand Up @@ -49,7 +50,11 @@ export class RemoveFailedNodeRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): RemoveFailedNodeRequestBase {
return RemoveFailedNodeRequestStatusReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return RemoveFailedNodeRequest.from(raw, ctx);
} else {
return RemoveFailedNodeRequestStatusReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedResponse,
messageTypes,
Expand Down Expand Up @@ -49,7 +50,11 @@ export class ReplaceFailedNodeRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): ReplaceFailedNodeRequestBase {
return ReplaceFailedNodeRequestStatusReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return ReplaceFailedNodeRequest.from(raw, ctx);
} else {
return ReplaceFailedNodeRequestStatusReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedCallback,
messageTypes,
Expand All @@ -31,7 +32,11 @@ export class RequestNodeNeighborUpdateRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): RequestNodeNeighborUpdateRequestBase {
return RequestNodeNeighborUpdateReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return RequestNodeNeighborUpdateRequest.from(raw, ctx);
} else {
return RequestNodeNeighborUpdateReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Message,
type MessageBaseOptions,
type MessageEncodingContext,
MessageOrigin,
type MessageParsingContext,
type MessageRaw,
MessageType,
Expand Down Expand Up @@ -50,7 +51,11 @@ export class SetLearnModeRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): SetLearnModeRequestBase {
return SetLearnModeCallback.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return SetLearnModeRequest.from(raw, ctx);
} else {
return SetLearnModeCallback.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedCallback,
expectedResponse,
Expand Down Expand Up @@ -43,7 +44,11 @@ export class SetSUCNodeIdRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): SetSUCNodeIdRequestBase {
return SetSUCNodeIdRequestStatusReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return SetSUCNodeIdRequest.from(raw, ctx);
} else {
return SetSUCNodeIdRequestStatusReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
FunctionType,
Message,
type MessageBaseOptions,
MessageOrigin,
MessageType,
expectedCallback,
expectedResponse,
Expand All @@ -45,7 +46,11 @@ export class SendDataBridgeRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): SendDataBridgeRequestBase {
return SendDataBridgeRequestTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return SendDataBridgeRequest.from(raw, ctx);
} else {
return SendDataBridgeRequestTransmitReport.from(raw, ctx);
}
}
}

Expand Down Expand Up @@ -317,7 +322,11 @@ export class SendDataMulticastBridgeRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): SendDataMulticastBridgeRequestBase {
return SendDataMulticastBridgeRequestTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return SendDataMulticastBridgeRequest.from(raw, ctx);
} else {
return SendDataMulticastBridgeRequestTransmitReport.from(raw, ctx);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Message,
type MessageBaseOptions,
type MessageEncodingContext,
MessageOrigin,
type MessageParsingContext,
type MessageRaw,
MessageType,
Expand All @@ -29,7 +30,11 @@ export class SendTestFrameRequestBase extends Message {
raw: MessageRaw,
ctx: MessageParsingContext,
): SendTestFrameRequestBase {
return SendTestFrameTransmitReport.from(raw, ctx);
if (ctx.origin === MessageOrigin.Host) {
return SendTestFrameRequest.from(raw, ctx);
} else {
return SendTestFrameTransmitReport.from(raw, ctx);
}
}
}

Expand Down
Loading