Project

General

Profile

Actions

Feature #4735

closed

SAT>IP server: add configuration to limit maximal count of sessions and user connections

Added by Mono Polimorph over 7 years ago. Updated over 7 years ago.

Status:
Fixed
Priority:
Normal
Category:
SAT>IP
Target version:
Start date:
2017-11-22
Due date:
% Done:

100%

Estimated time:

Description

Hi Jaroslav,

Please, can you help me to complete this code?

diff --git a/src/satip/server.c b/src/satip/server.c
index 57d8487..84e9b17 100644
--- a/src/satip/server.c
+++ b/src/satip/server.c
@@ -873,6 +873,25 @@ const idclass_t satip_server_class = {
       .group  = 4,
     },
     {
+      .type   = PT_INT,
+      .id     = "satip_max_sessions",
+      .name   = N_("Max Sessions"),
+      .desc   = N_("The maximum number of active RTSP sessions."),
+      .off    = offsetof(struct satip_server_conf, satip_max_sessions),
+      .opts   = PO_ADVANCED,
+      .group  = 4,
+    },
+    {
+      .type   = PT_INT,
+      .id     = "satip_max_user_connections",
+      .name   = N_("Max User connections"),
+      .desc   = N_("The maximum concurrent RTSP connections from the " 
+                   "same IP address."),
+      .off    = offsetof(struct satip_server_conf, satip_max_user_connections),
+      .opts   = PO_ADVANCED,
+      .group  = 4,
+    },
+    {
       .type   = PT_BOOL,
       .id     = "satip_rewrite_pmt",
       .name   = N_("Rewrite PMT"),
diff --git a/src/satip/server.h b/src/satip/server.h
index f72c01a..5b9ecbd 100644
--- a/src/satip/server.h
+++ b/src/satip/server.h
@@ -63,6 +63,8 @@ struct satip_server_conf {
   int satip_dvbc2;
   int satip_atsc_t;
   int satip_atsc_c;
+  int satip_max_sessions;
+  int satip_max_user_connections;
   char *satip_nat_ip;
   int satip_nat_rtsp;
   int satip_nat_name_force;
The idea is quite simple:
  1. Limit the total number of active sessions. The SAT>IP config has the exported tuner values. However, this is only informational data. No limit is applyed, except the real number of attached tuners. However, when using IPTV inputs, the number of "active" tuners is undefined. I like to use this value for not export more than X sessions at a time.
  2. The other value is for limit the number of concurrent RTSP connections from the same IP. Some wrong SAT>IP clients not disconnect the RTSP socket. Or they open more than one session. I like to limit this value.

So, I'm sure you know where to do the check. The code I feel is around two if's, two increments and some decrement.
Please, can you do that?
Thank you!


Files

Actions

Also available in: Atom PDF