summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--config.c4
-rw-r--r--config.h8
-rw-r--r--frontend_svr.c18
-rw-r--r--frontend_svr.h5
-rw-r--r--setup_menu.c6
6 files changed, 32 insertions, 10 deletions
diff --git a/HISTORY b/HISTORY
index 3771b929..5039d48a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,7 @@ VDR Plugin 'xineliboutput' Revision History
????-??-??: Version 1.1.0
+- Added an option to limit number of remote clients
- Added math library (-lm) to vdr-sxfe when building with
Xrender / HUD OSD support (Thanks to Anssi Hannula)
- Implemented build-time configuration script
diff --git a/config.c b/config.c
index 7ec40bd5..7e54837c 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c,v 1.73 2008-11-10 20:10:33 phintuka Exp $
+ * $Id: config.c,v 1.74 2008-11-18 14:09:07 phintuka Exp $
*
*/
@@ -541,6 +541,7 @@ config_t::config_t() {
remote_mode = 0;
listen_port = LISTEN_PORT;
remote_keyboard = 1;
+ remote_max_clients = MAXCLIENTS;
remote_usetcp = 1;
remote_useudp = 1;
remote_usertp = 1;
@@ -768,6 +769,7 @@ bool config_t::SetupParse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "RemoteMode")) remote_mode = atoi(Value);
else if (!strcasecmp(Name, "Remote.ListenPort")) listen_port = atoi(Value);
else if (!strcasecmp(Name, "Remote.Keyboard")) remote_keyboard = atoi(Value);
+ else if (!strcasecmp(Name, "Remote.MaxClients")) remote_max_clients = atoi(Value);
else if (!strcasecmp(Name, "Remote.UseTcp")) remote_usetcp = atoi(Value);
else if (!strcasecmp(Name, "Remote.UseUdp")) remote_useudp = atoi(Value);
else if (!strcasecmp(Name, "Remote.UseRtp")) remote_usertp = atoi(Value);
diff --git a/config.h b/config.h
index e28f4f0f..16a6f1fd 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h,v 1.55 2008-11-10 20:10:33 phintuka Exp $
+ * $Id: config.h,v 1.56 2008-11-18 14:09:07 phintuka Exp $
*
*/
@@ -18,6 +18,9 @@
#include <vdr/config.h>
+// Max number of remote clients
+#define MAXCLIENTS 10
+
// Decoder buffer size
#define PES_BUFFERS_CUSTOM 0
#define PES_BUFFERS_TINY_50 1
@@ -358,8 +361,9 @@ class config_t {
char remote_local_if[32]; // Listen only on this interface
char remote_local_ip[32]; // Bind locally to this IP
int remote_keyboard; // Allow remote client to control VDR with keyboard, LIRC, etc.
+ int remote_max_clients; // Max. number of clients
- int remote_usebcast; // Use proadcasts to find servers automatically
+ int remote_usebcast; // Use broadcasts to find servers automatically
int remote_usepipe; // enable local pipes for video transport
int remote_usertp; // enable RTP multicast for video transport
int remote_useudp; // enable UDP unicast for video transport
diff --git a/frontend_svr.c b/frontend_svr.c
index c58888f4..6b0ffad3 100644
--- a/frontend_svr.c
+++ b/frontend_svr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend_svr.c,v 1.61 2008-11-16 15:02:45 rofafor Exp $
+ * $Id: frontend_svr.c,v 1.62 2008-11-18 14:09:08 phintuka Exp $
*
*/
@@ -1697,7 +1697,7 @@ void cXinelibServer::Handle_ClientConnected(int fd)
return;
}
- if(cli>=MAXCLIENTS) {
+ if(cli>=xc.remote_max_clients || cli>=MAXCLIENTS) {
const char *msg = "Server busy.\r\n";
ssize_t len = strlen(msg);
// too many clients
@@ -1736,8 +1736,20 @@ void cXinelibServer::Handle_Discovery_Broadcast(void)
struct sockaddr_in from;
if(udp_discovery_recv(fd_discovery, buf, 0, &from) > 0)
- if(udp_discovery_is_valid_search(buf))
+ if(udp_discovery_is_valid_search(buf)) {
+
+ // Reply only if we can accept one more client
+ int clients = 0;
+ for(int c=0; c<MAXCLIENTS; c++)
+ if(fd_control[c].open())
+ clients++;
+ if(clients >= xc.remote_max_clients) {
+ LOGMSG("Not replying to discovery broadcast (too many clients)");
+ return;
+ }
+
udp_discovery_broadcast(fd_discovery, m_Port, xc.remote_local_ip);
+ }
}
void cXinelibServer::Action(void)
diff --git a/frontend_svr.h b/frontend_svr.h
index f8809f1c..cd7e9fb7 100644
--- a/frontend_svr.h
+++ b/frontend_svr.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend_svr.h,v 1.18 2007-03-15 13:29:04 phintuka Exp $
+ * $Id: frontend_svr.h,v 1.19 2008-11-18 14:09:08 phintuka Exp $
*
*/
@@ -12,12 +12,11 @@
#define __XINELIB_FRONTEND_SVR_H
+#include "config.h"
#include "frontend.h"
//----------------------------- cXinelibServer --------------------------------
-#define MAXCLIENTS 10
-
class cBackgroundWriterI;
class cUdpScheduler;
class cStcFuture;
diff --git a/setup_menu.c b/setup_menu.c
index e2230323..2b4e3950 100644
--- a/setup_menu.c
+++ b/setup_menu.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: setup_menu.c,v 1.63 2008-11-01 07:23:00 phintuka Exp $
+ * $Id: setup_menu.c,v 1.64 2008-11-18 14:09:07 phintuka Exp $
*
*/
@@ -1466,6 +1466,9 @@ void cMenuSetupRemote::Set(void)
&newconfig.remote_local_ip[0], 16, "0123456789."));
Add(new cMenuEditBoolItem(tr(" Remote keyboard"),
&newconfig.remote_keyboard));
+ Add(new cMenuEditIntItem( tr(" Max number of clients"),
+ &newconfig.remote_max_clients,
+ 1, MAXCLIENTS));
Add(new cMenuEditBoolItem(tr(" PIPE transport"),
&newconfig.remote_usepipe));
@@ -1570,6 +1573,7 @@ void cMenuSetupRemote::Store(void)
SetupStore("Remote.LocalIP", xc.remote_local_ip);
SetupStore("Remote.Keyboard", xc.remote_keyboard);
+ SetupStore("Remote.MaxClients", xc.remote_max_clients);
SetupStore("Remote.UsePipe",xc.remote_usepipe);
SetupStore("Remote.UseTcp", xc.remote_usetcp);
SetupStore("Remote.UseUdp", xc.remote_useudp);