mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
limit the number of concurrent connections for all four protocols
kick a client if it doesn't authenticate within 5s on ESD and native protocol git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@292 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
c57d5deef6
commit
eef235d879
4 changed files with 104 additions and 12 deletions
|
|
@ -29,6 +29,10 @@
|
|||
#include "protocol-cli.h"
|
||||
#include "cli.h"
|
||||
#include "xmalloc.h"
|
||||
#include "log.h"
|
||||
|
||||
/* Don't allow more than this many concurrent connections */
|
||||
#define MAX_CONNECTIONS 10
|
||||
|
||||
struct pa_protocol_cli {
|
||||
struct pa_module *module;
|
||||
|
|
@ -49,6 +53,12 @@ static void on_connection(struct pa_socket_server*s, struct pa_iochannel *io, vo
|
|||
struct pa_cli *c;
|
||||
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_cli_new(p->core, io, p->module);
|
||||
assert(c);
|
||||
pa_cli_set_eof_callback(c, cli_eof_cb, p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue