Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforce.net>2011-04-28 09:47:36 +0400
committerJustin Maggard <jmaggard@users.sourceforce.net>2011-04-28 09:47:36 +0400
commit6117d6d313131a4056b0bf49842e636f08f3f6a0 (patch)
tree8ecfccab6184554ad3ab621e03f7a3c2049f2bc9 /minidlna.c
parentdb213a28a97ae5a1484f24f5a86de827b7bde1db (diff)
* Fix bug where the UpdateID was not being incremented during a full rescan.
Diffstat (limited to 'minidlna.c')
-rw-r--r--minidlna.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/minidlna.c b/minidlna.c
index 3a0570c..4f37349 100644
--- a/minidlna.c
+++ b/minidlna.c
@@ -201,7 +201,7 @@ parselanaddr(struct lan_addr_s * lan_addr, const char * str)
return 0;
}
-void
+static void
getfriendlyname(char * buf, int len)
{
char * dot = NULL;
@@ -296,7 +296,7 @@ getfriendlyname(char * buf, int len)
#endif
}
-int
+static int
open_db(void)
{
char path[PATH_MAX];
@@ -816,7 +816,8 @@ main(int argc, char * * argv)
struct upnphttp * next;
fd_set readset; /* for select() */
fd_set writeset;
- struct timeval timeout, timeofday, lastnotifytime = {0, 0}, lastupdatetime = {0, 0};
+ struct timeval timeout, timeofday, lastnotifytime = {0, 0};
+ time_t lastupdatetime = 0;
int max_fd = -1;
int last_changecnt = 0;
short int new_db = 0;
@@ -1038,7 +1039,10 @@ main(int argc, char * * argv)
if( scanning )
{
if( !scanner_pid || kill(scanner_pid, 0) )
+ {
scanning = 0;
+ updateID++;
+ }
}
/* select open sockets (SSDP, HTTP listen, and all HTTP soap sockets) */
@@ -1047,13 +1051,13 @@ main(int argc, char * * argv)
if (sudp >= 0)
{
FD_SET(sudp, &readset);
- max_fd = MAX( max_fd, sudp);
+ max_fd = MAX(max_fd, sudp);
}
if (shttpl >= 0)
{
FD_SET(shttpl, &readset);
- max_fd = MAX( max_fd, shttpl);
+ max_fd = MAX(max_fd, shttpl);
}
#ifdef TIVO_SUPPORT
if (sbeacon >= 0)
@@ -1068,7 +1072,7 @@ main(int argc, char * * argv)
if((e->socket >= 0) && (e->state <= 2))
{
FD_SET(e->socket, &readset);
- max_fd = MAX( max_fd, e->socket);
+ max_fd = MAX(max_fd, e->socket);
i++;
}
}
@@ -1104,14 +1108,14 @@ main(int argc, char * * argv)
#endif
/* increment SystemUpdateID if the content database has changed,
* and if there is an active HTTP connection, at most once every 2 seconds */
- if( i && (time(NULL) >= (lastupdatetime.tv_sec + 2)) )
+ if( i && (timeofday.tv_sec >= (lastupdatetime + 2)) )
{
- if( sqlite3_total_changes(db) != last_changecnt )
+ if( scanning || sqlite3_total_changes(db) != last_changecnt )
{
updateID++;
last_changecnt = sqlite3_total_changes(db);
upnp_event_var_change_notify(EContentDirectory);
- memcpy(&lastupdatetime, &timeofday, sizeof(struct timeval));
+ lastupdatetime = timeofday.tv_sec;
}
}
/* process active HTTP connections */