diff options
author | phintuka <phintuka> | 2010-06-02 10:27:59 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2010-06-02 10:27:59 +0000 |
commit | 4c78a923e6f8bed41946743643d83da06114d862 (patch) | |
tree | ba26fd7bfaa305e1d88f261cd0a5bedcae93338f | |
parent | a1345b4b30d30654bfa358df88a8bbfbb9c8948a (diff) | |
download | xineliboutput-4c78a923e6f8bed41946743643d83da06114d862.tar.gz xineliboutput-4c78a923e6f8bed41946743643d83da06114d862.tar.bz2 |
Do not allow connections if we're not the primary device
-rw-r--r-- | frontend_svr.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/frontend_svr.c b/frontend_svr.c index d0408725..bd8eca9d 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.93 2010-05-27 12:04:50 phintuka Exp $ + * $Id: frontend_svr.c,v 1.94 2010-06-02 10:27:59 phintuka Exp $ * */ @@ -1757,7 +1757,16 @@ void cXinelibServer::Handle_ClientConnected(int fd) m_ConnType[cli] = ctDetecting; fd_control[cli].set_handle(fd); fd_control[cli].set_buffers(KILOBYTE(128), KILOBYTE(128)); - cXinelibDevice::Instance().ForcePrimaryDevice(true); + + if (!cXinelibDevice::Instance().ForcePrimaryDevice(true)) { + const char *msg = "Not primary device.\r\n"; + ssize_t len = strlen(msg); + LOGMSG("Dropping client: xineliboutput is not the primary device !"); + if(write(fd, msg, len) != len) + LOGERR("Write failed."); + CLOSESOCKET(fd); + return; + } } void cXinelibServer::Handle_Discovery_Broadcast(void) |