]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: fix the DVR limit per user condition (substract self)
authorJaroslav Kysela <perex@perex.cz>
Mon, 21 Oct 2019 08:08:01 +0000 (10:08 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 21 Oct 2019 08:08:01 +0000 (10:08 +0200)
src/dvr/dvr_rec.c

index 4f8fe4c2de8f27dc629f7f000a449d8226985d85..d8b95a1ba18ebe76133d4e8e79b4810cc3a96893 100644 (file)
@@ -108,8 +108,9 @@ dvr_rec_subscribe(dvr_entry_t *de)
   }
 
   if (aa->aa_conn_limit || aa->aa_conn_limit_dvr) {
-    rec_count = dvr_usage_count(aa);
+    rec_count = dvr_usage_count(aa) - 1; /* substract self */
     net_count = aa->aa_conn_limit ? tcp_connection_count(aa) : 0;
+    assert(rec_count >= 0);
     /* the rule is: allow if one condition is OK */
     c1 = aa->aa_conn_limit ? rec_count + net_count >= aa->aa_conn_limit : -1;
     c2 = aa->aa_conn_limit_dvr ? rec_count >= aa->aa_conn_limit_dvr : -1;