Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
Support for WDM subscriptions over connections
Browse files Browse the repository at this point in the history
-- Various changes supporting use of WDM subscriptions over connection-oriented transports.
As part of this effort, a number of general bugs were also fixed.

-- Use AutoRequestAck feature of ExchangeContext for all WRM subscription exchanges.  This
allows the code in SubscriptionClient and SubscriptionHandler classes to be neutral with
regard to connection-oriented/conectionless transports when sending Weave messages.

-- Re-wrote the handling of subscription termination in the SubscriptionClient and
SubscriptionHandler classes.  This greatly simplified the logic, making it easier to reason
about the correctness of the code.  This change also resolves WEAV-2367.

-- Added code to detect binding failures and terminate any associated subscriptions.  This
ensures, for example, that a subscription is terminated whenever its underlying connection
is lost.  This change also fixed a long-standing bug related to connectionless subscriptions
wherein a session failure would not immediate result in the failure of a subscription.

-- Fixed a bug in SubscriptionClient where the OnSubscriptionTerminated event was not
delivered to the application in certain cases.  This left the application unaware that the
underlying subscription was gone.  This fix necessitated various changes to the WDM
functional tests which had been coded to assume the erroneous behavior.

-- Fixed a bug in SubscriptionClient and SubscriptionHandler where the standalone ACK for a
StatusReport received in response to a SubscribeCancelRequest would never be sent.

-- Revised ifdefs in SubscriptionClient and UdpateClient so that both can be built with WRM
disabled. (Note that there are various hard dependencies on WRM in the test tools unrelated
to subscription/update support.  These were not addressed.)

-- Added interface documentation describing new subscription termination behavior.

-- Minor logging clean-ups in TraitData and StatusReportStr().

Updated WDM functional tests

-- Updated the happy-based WDM functional tests to accommodate changes to the
SubscriptionClient and SubscriptionHandler implementations introduced as a result of adding
support for WDM over connection-oriented transports.

-- Changed numerous python test scripts that have hard-coded dependencies on particular C++
method names appearing in log output.

-- Fixed logic bugs in the MockWdmSubscriptionInitiator/Responder classes that depended on
the existence of particular bugs in SubscriptionClient and SubscriptionHandler, which have
now been fixed.

-- Added additional logging as an aid to understanding the behavior of the
MockWdmSubscriptionInitiator/Responder classes.

-- Added option to TestWdmNext tool to enable use of WDM over a TCP connection.  Note that,
as of yet, there are no automated tests that exercise this feature.
  • Loading branch information
Jay Logue authored and yunhanw-google committed Jan 3, 2020
1 parent cafa7cf commit bf446e9
Show file tree
Hide file tree
Showing 77 changed files with 725 additions and 642 deletions.
12 changes: 8 additions & 4 deletions src/lib/profiles/data-management/Current/NotificationEngine.cpp
Expand Up @@ -1121,13 +1121,17 @@ WEAVE_ERROR NotificationEngine::SendNotify(PacketBuffer * aBuffer, SubscriptionH
{
WEAVE_ERROR err = WEAVE_NO_ERROR;

err = aSubHandler->SendNotificationRequest(aBuffer);
SuccessOrExit(err);

// We can only have 1 notify in flight for any given subscription - increment and break out.
mNumNotifiesInFlight++;

err = aSubHandler->SendNotificationRequest(aBuffer);
SuccessOrExit(err);

exit:
if (err != WEAVE_NO_ERROR)
{
mNumNotifiesInFlight--;
}
return err;
}

Expand Down Expand Up @@ -1583,7 +1587,7 @@ WEAVE_ERROR NotificationEngine::BuildSingleNotifyRequest(SubscriptionHandler * a
{
// abort subscription, squash error, signal to upper
// layers that the subscription is done
aSubHandler->HandleSubscriptionTerminated(err, NULL);
aSubHandler->TerminateSubscription(err, NULL, false);

aSubscriptionHandled = true;
err = WEAVE_NO_ERROR;
Expand Down

0 comments on commit bf446e9

Please sign in to comment.