clients: keep generic device records

Now that we display connected clients in the status page,
it makes sense that we show all of them, instead of only
recognized device types.
This commit is contained in:
Justin Maggard 2014-02-26 12:34:15 -08:00
parent 005cb0bd30
commit ea9a530a3a
3 changed files with 34 additions and 31 deletions

View File

@ -194,6 +194,13 @@ struct client_type_s client_types[] =
EUserAgent
},
{ EStandardUPnP,
0,
"Generic UPnP 1.0",
"UPnP/1.0",
EUserAgent
},
{ 0, 0, NULL, 0 }
};

View File

@ -21,7 +21,7 @@
#include <sys/time.h>
#include <netinet/in.h>
#define CLIENT_CACHE_SLOTS 20
#define CLIENT_CACHE_SLOTS 25
#define FLAG_DLNA 0x00000001
#define FLAG_MIME_AVI_DIVX 0x00000002
@ -66,7 +66,8 @@ enum client_types {
ESonyBravia,
ESonyInternetTV,
EToshibaTV,
EStandardDLNA150
EStandardDLNA150,
EStandardUPnP
};
struct client_type_s {

View File

@ -427,20 +427,18 @@ next_header:
* This is done because a lot of clients like to send a
* different User-Agent with different types of requests. */
n = SearchClientCache(h->clientaddr, 0);
if( h->req_client )
{
/* Add this client to the cache if it's not there already. */
if( n < 0 )
{
AddClientCache(h->clientaddr, h->req_client);
}
else
else if (h->req_client)
{
enum client_types type = client_types[h->req_client].type;
enum client_types ctype = client_types[clients[n].type].type;
/* If we know the client and our new detection is generic, use our cached info */
/* If we detected a Samsung Series B earlier, don't overwrite it with Series A info */
if ((ctype < EStandardDLNA150 && type == EStandardDLNA150) ||
if ((ctype && ctype < EStandardDLNA150 && type >= EStandardDLNA150) ||
(ctype == ESamsungSeriesB && type == ESamsungSeriesA))
{
h->req_client = clients[n].type;
@ -449,11 +447,8 @@ next_header:
clients[n].type = h->req_client;
clients[n].age = time(NULL);
}
}
else if( n >= 0 )
{
else
h->req_client = clients[n].type;
}
}
/* very minimalistic 400 error message */
@ -991,7 +986,7 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h)
{
SendResp_caption(h, HttpUrl+10);
}
else if(strcmp(HttpUrl, "/status/") == 0)
else if(strncmp(HttpUrl, "/status", 7) == 0)
{
SendResp_presentation(h);
}