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

Work on MessageReassembler #77

Merged
merged 1 commit into from
Nov 3, 2017
Merged
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 @@ -189,6 +189,10 @@ internal async Task<IncomingMessage> ProcessAsync(CancellationToken cancellation
// FIXME
// evaluate the purpose of this reply back to the nanoFramework device, the nanoCLR doesn't seem to have to handle this. In the end it looks like this does have any real purpose and will only be wasting CPU.
await IncomingMessage.ReplyBadPacketAsync(_parent, Flags.c_BadHeader, cancellationToken);

// setup restart
_state = ReceiveState.Initialize;

return GetCompleteMessage();
}

Expand Down Expand Up @@ -225,12 +229,16 @@ internal async Task<IncomingMessage> ProcessAsync(CancellationToken cancellation
{
DebuggerEventSource.Log.WireProtocolReceiveState(_state);

// setup restart
_state = ReceiveState.Initialize;

return GetCompleteMessage();
}
else
{
// this is not the message we were waiting
// no need to wait for execution just throw it
Debug.WriteLine("-->>>");
_parent.App.ProcessMessageAsync(GetCompleteMessage(), fReply).FireAndForget();
}

Expand All @@ -252,6 +260,10 @@ internal async Task<IncomingMessage> ProcessAsync(CancellationToken cancellation
// FIXME
// evaluate the purpose of this reply back to the nanoFramework device, the nanoCLR doesn't seem to have to handle this. In the end it looks like this does have any real purpose and will only be wasting CPU.
await IncomingMessage.ReplyBadPacketAsync(_parent, Flags.c_BadPayload, cancellationToken);

// setup restart
_state = ReceiveState.Initialize;

return GetCompleteMessage();
}

Expand Down Expand Up @@ -323,7 +335,7 @@ public async Task<bool> ProcessMessage(IncomingMessage msg, bool fReply, Cancell

Request reply = null;

if (request.MatchesReply(msg))
if (request != null && request.MatchesReply(msg))
{
reply = request;

Expand Down