Re: [gupnp] handling of sequence numbers in gupnp-service-proxy.c

Hi Sven!

On Wed, Mar 25, 2009 at 4:42 PM, Sven Neumann <s neumann phase-zero de> wrote:
> Hi,
> we have been having problems over the last week where notifications did
> not end up being received in GUPnPServiceProxy. After some debugging we
> found that the following code in gupnp-service-proxy.c is the culprit:
>        hdr = soup_message_headers_get (msg->request_headers, "SEQ");
>        if (hdr == NULL) {
>                /* No SEQ header */
>                soup_message_set_status (msg,
>                                     SOUP_STATUS_PRECONDITION_FAILED);
>                return;
>        }
>        seq = atoi (hdr);
>        if (seq > proxy->priv->seq) {
>                /* Oops, we missed a notify. Resubscribe .. */
>                unsubscribe (proxy);
>                subscribe (proxy);
>                /* Message was OK otherwise */
>                soup_message_set_status (msg, SOUP_STATUS_OK);
>                return;
>        }
> This code extracts the SEQ number from the HTTP header and compares it
> to the expected sequence number which is incremented for each received
> NOTIFY message. If there's a mismatch, the message is silently discarded
> and the service-proxy unsubscribes itself and subscribes again. I don't
> quite understand the reasons for handling it this way. The proxy is
> obviously subscribed just fine, otherwise it wouldn't have received this
> message. So why is there a need to resubscribe? And what's worse, why is
> the message silently discarded?
> What's the purpose of the SEQ header? If it is there to make sure that
> messages are received in the order they are sent, then GUPnPServiceProxy
> should probably have a message queue where out-of-order messages are
> kept until outstanding messages are received.

  The behavior seems to be dictated by UPnP spec: "To repair an event
subscription, e.g., if a subscriber has missed one or more event
messages, a subscriber must unsubscribe and re-subscribe. By doing so,
the subscriber will get a new subscription identifier, a new initial
event message, and a new event key."  p69 UPnP Device Architecture v1.


Zeeshan Ali (Khattak)
FSF member#5124
To unsubscribe send a mail to gupnp+unsubscribe\

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]