Switch to unified view

a/libupnpp/control/discovery.cxx b/libupnpp/control/discovery.cxx
...
...
108
// Example: ContentDirectories appearing and disappearing from the network
108
// Example: ContentDirectories appearing and disappearing from the network
109
// We queue a task for our worker thread(s)
109
// We queue a task for our worker thread(s)
110
// We can get called by several threads.
110
// We can get called by several threads.
111
static int cluCallBack(Upnp_EventType et, void* evp, void*)
111
static int cluCallBack(Upnp_EventType et, void* evp, void*)
112
{
112
{
113
    LOGDEB1("discovery:cluCallBack: " << LibUPnP::evTypeAsString(et) << endl);
114
115
    switch (et) {
113
    switch (et) {
116
    case UPNP_DISCOVERY_SEARCH_RESULT:
114
    case UPNP_DISCOVERY_SEARCH_RESULT:
117
    case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
115
    case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
118
    {
116
    {
119
        struct Upnp_Discovery *disco = (struct Upnp_Discovery *)evp;
117
        struct Upnp_Discovery *disco = (struct Upnp_Discovery *)evp;
...
...
122
        // services. AFAIK they all point to the same description.xml document,
120
        // services. AFAIK they all point to the same description.xml document,
123
        // which has all the interesting data. So let's try to only process
121
        // which has all the interesting data. So let's try to only process
124
        // one message per device: the one which probably correspond to the
122
        // one message per device: the one which probably correspond to the
125
        // upnp "root device" message and has empty service and device types:
123
        // upnp "root device" message and has empty service and device types:
126
        if (disco->DeviceType[0] || disco->ServiceType[0]) {
124
        if (disco->DeviceType[0] || disco->ServiceType[0]) {
125
            LOGDEB1("discovery:cllb:SearchRes/Alive: ignoring message with no"
126
                    "device/service type\n");
127
            return UPNP_E_SUCCESS;
127
            return UPNP_E_SUCCESS;
128
        }
128
        }
129
129
130
        LOGDEB1("discovery:cllb:ALIVE: " << cluDiscoveryToStr(disco) << endl);
130
        LOGDEB1("discovery:cllb:SearchRes/Alive: " <<
131
                cluDiscoveryToStr(disco) << endl);
131
132
132
        // Device signals its existence and well-being. Perform the
133
        // Device signals its existence and well-being. Perform the
133
        // UPnP "description" phase by downloading and decoding the
134
        // UPnP "description" phase by downloading and decoding the
134
        // description document.
135
        // description document.
135
136
...
...
174
        break;
175
        break;
175
    }
176
    }
176
    case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
177
    case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
177
    {
178
    {
178
        struct Upnp_Discovery *disco = (struct Upnp_Discovery *)evp;
179
        struct Upnp_Discovery *disco = (struct Upnp_Discovery *)evp;
179
        //LOGDEB("discovery:cllB:BYEBYE: " << cluDiscoveryToStr(disco) << endl);
180
        LOGDEB1("discovery:cllB:BYEBYE: " << cluDiscoveryToStr(disco) << endl);
180
        DiscoveredTask *tp = new DiscoveredTask(0, disco);
181
        DiscoveredTask *tp = new DiscoveredTask(0, disco);
181
        if (!discoveredQueue.put(tp)) {
182
        if (!discoveredQueue.put(tp)) {
182
            LOGERR("discovery:cllb: queue.put failed\n");
183
            LOGERR("discovery:cllb: queue.put failed\n");
183
        }
184
        }
184
        break;
185
        break;