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

Resolving Issue #25 Observe in client is not working #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 14 additions & 3 deletions src/coap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,20 @@ static void handleClientInteraction(CoAP_Interaction_t* pIA) {

// pIA->State = COAP_STATE_FINISHED;
// CoAP_EnqueueLastInteraction(pIA);
CoAP_DeleteInteraction(
pIA); //direct delete, todo: eventually wait some time to send ACK instead of RST if out ACK to remote reponse was lost

//Unused obsVal, required to call GetObservOptionFromMessage
int obsVal = 0;
//Required to support client Observe functionality
//If client request contains observe option, the interaction should not be deleted as it is ongoing.
//The Client State Machine returns to COAP_STATE_WAITING_RESPONSE and the interaction is requeued.
if (GetObserveOptionFromMsg(pIA->pRespMsg,&obsVal) == COAP_OK )
{
pIA->State= COAP_STATE_WAITING_RESPONSE;
CoAP_EnqueueLastInteraction(pIA);
}
else
{
CoAP_DeleteInteraction(pIA); //direct delete, todo: eventually wait some time to send ACK instead of RST if out ACK to remote reponse was lost
}
} else {
if (pIA->RespCB != NULL) {
pIA->RespCB(NULL, pIA->pReqMsg, &pIA->RemoteEp);
Expand Down