#include "xmalloc.h"
#include "log.h"
+/* Don't allow more than this many concurrent connections */
+#define MAX_CONNECTIONS 10
+
struct connection {
struct pa_protocol_simple *protocol;
struct pa_iochannel *io;
char cname[256];
assert(s && io && p);
+ if (pa_idxset_ncontents(p->connections)+1 > MAX_CONNECTIONS) {
+ pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS);
+ pa_iochannel_free(io);
+ return;
+ }
+
c = pa_xmalloc(sizeof(struct connection));
c->io = io;
c->sink_input = NULL;