Bob Ciora's patch for lazy UpnpAcceptSubscription().
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@395 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
a8521c09cf
commit
b4b4ee982f
42
ChangeLog
42
ChangeLog
@ -2,6 +2,48 @@
|
||||
Version 1.8.0
|
||||
*******************************************************************************
|
||||
|
||||
2008-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Bug Tracker [ 1903069 ]
|
||||
Subs (not services) not marked 'active'
|
||||
Submitted By: Bob Ciora - bobciora
|
||||
|
||||
If the UpnpAcceptSubscription is not called, the subscription is not marked
|
||||
as "active", so no state variables will ever be sent.
|
||||
|
||||
I have a "lazy" architecture where a service may not be ready to publish
|
||||
any state data at the time of a subscription. Subscriptions are still
|
||||
accepted, there's just nothing to send, so UpnpAcceptSubscription is never
|
||||
called. As a result, the subscription is never marked as "active" via the
|
||||
genaInitNotify functions.
|
||||
|
||||
A best course of action would be to modify UpnpAcceptSubscription<...>
|
||||
functions so that they can accept *no* initial state information, but can
|
||||
still result in the subscription being marked as active. Technically,
|
||||
then, the "active" flag should be set here, not in the genaInitNotify<...>
|
||||
functions.
|
||||
|
||||
But the UpnpAccept functions don't muck with the subscription table, and
|
||||
it's more work than it's worth to move that code from the gena fucntions to
|
||||
the upnpapi functions.
|
||||
|
||||
So--- what I've done to correct this problem is to modify both
|
||||
UpnpAcceptSubscription<...> functions (in upnppapi.c) to accept an empty
|
||||
state list and still call the gena layer functions. The gena layer
|
||||
genaInitNotify<...> functions (gena_device.c) then mark the subscription as
|
||||
"active" *before* checking for an empty state set.
|
||||
|
||||
In genaInitNotify, a check for "var_count <= 0" is added immediately after
|
||||
the "subs->active = 1;" line. If this occurs, then all cleanup is
|
||||
performed and the function returns GENA_SUCCESS (since now, an empty state
|
||||
list is not an error). The same check is made for "PropSet == 0" in
|
||||
genaInitNotifyExt (just after the "subs->active = 1;" line).
|
||||
|
||||
I've modifified my proxy layer to call UpnpAcceptSubscriptionExt even when
|
||||
there is no state data to send. With the suggested changes to
|
||||
gena_device.c, later state changes are sent correctly.
|
||||
|
||||
This has solved my problem.
|
||||
|
||||
2008-05-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Ported Peter Hartley's patch to compile with mingw.
|
||||
|
||||
|
@ -2249,12 +2249,15 @@ int UpnpAcceptSubscription(
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
/* Now accepts an empty state list, so the code below is commented out */
|
||||
#if 0
|
||||
if (VarName == NULL || NewVal == NULL || cVariables < 0) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
#endif
|
||||
|
||||
HandleUnlock();
|
||||
|
||||
@ -2342,13 +2345,15 @@ int UpnpAcceptSubscriptionExt(
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
/* Now accepts an empty state list, so the code below is commented out */
|
||||
#if 0
|
||||
if (PropSet == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
#endif
|
||||
|
||||
HandleUnlock();
|
||||
|
||||
|
@ -486,6 +486,12 @@ int genaInitNotify(
|
||||
"FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s", sid);
|
||||
sub->active = 1;
|
||||
|
||||
if (var_count <= 0) {
|
||||
line = __LINE__;
|
||||
ret = GENA_SUCCESS;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
ret = GeneratePropertySet(VarNames, VarValues, var_count, &propertySet );
|
||||
if (ret != XML_SUCCESS) {
|
||||
line = __LINE__;
|
||||
@ -548,7 +554,7 @@ int genaInitNotify(
|
||||
}
|
||||
|
||||
ExitFunction:
|
||||
if (ret != GENA_SUCCESS) {
|
||||
if (ret != GENA_SUCCESS || var_count <= 0) {
|
||||
free(thread_struct);
|
||||
free(headers);
|
||||
ixmlFreeDOMString(propertySet);
|
||||
@ -646,6 +652,12 @@ int genaInitNotifyExt(
|
||||
"FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s", sid);
|
||||
sub->active = 1;
|
||||
|
||||
if (PropSet == 0) {
|
||||
line = __LINE__;
|
||||
ret = GENA_SUCCESS;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
propertySet = ixmlPrintNode((IXML_Node *)PropSet);
|
||||
if( propertySet == NULL ) {
|
||||
line = __LINE__;
|
||||
@ -709,7 +721,7 @@ int genaInitNotifyExt(
|
||||
}
|
||||
|
||||
ExitFunction:
|
||||
if (ret != GENA_SUCCESS) {
|
||||
if (ret != GENA_SUCCESS || PropSet == 0) {
|
||||
free(thread_struct);
|
||||
free(headers);
|
||||
ixmlFreeDOMString(propertySet);
|
||||
|
Loading…
x
Reference in New Issue
Block a user