diff options
author | michux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-03-26 12:55:55 +0000 |
---|---|---|
committer | michux <michux@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-03-26 12:55:55 +0000 |
commit | 89efe119450c44b99e988ff4102fdd9c47cfbf70 (patch) | |
tree | 7926d543a29dc1d493721dc42f30206c569ae42c | |
parent | 27c5e0c61337827ab84a8dd533145a94d251b985 (diff) | |
download | lcd4linux-89efe119450c44b99e988ff4102fdd9c47cfbf70.tar.gz |
add max client option
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1005 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r-- | drv_vnc.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -69,6 +69,7 @@ static rfbScreenInfoPtr server; static int xres = 320; static int yres = 200; static int BPP = 4; +static int max_clients = 2; static int clientCount = 0; @@ -81,10 +82,15 @@ static void clientgone(rfbClientPtr cl) static enum rfbNewClientAction newclient(rfbClientPtr cl) { - cl->clientGoneHook = clientgone; - clientCount++; - debug("%d clients connected\n", clientCount); - return RFB_CLIENT_ACCEPT; + if (clientCount < max_clients) { + clientCount++; + cl->clientGoneHook = clientgone; + debug("%d clients connected\n", clientCount); + return RFB_CLIENT_ACCEPT; + } else { + info("client refused due max. client connections (%d)\n", clientCount); + return RFB_CLIENT_REFUSE; + } } /* handle mouse action */ @@ -103,7 +109,7 @@ static void doptr(int buttonMask, int x, int y, rfbClientPtr cl) static int drv_vnc_open(const char *Section) { if (cfg_number(Section, "xres", 320, 32, 2048, &xres) < 1) { - info("[DRV_VNC] no '%s.xres' entry from %s using default %d", Section, cfg_source(), xres); + info("[DRV_VNC] no '%s.xres' entry frXom %s using default %d", Section, cfg_source(), xres); } if (cfg_number(Section, "yres", 200, 32, 2048, &yres) < 1) { info("[DRV_VNC] no '%s.yres' entry from %s using default %d", Section, cfg_source(), yres); @@ -111,6 +117,9 @@ static int drv_vnc_open(const char *Section) if (cfg_number(Section, "bpp", 4, 1, 4, &BPP) < 1) { info("[DRV_VNC] no '%s.bpp' entry from %s using default %d", Section, cfg_source(), BPP); } + if (cfg_number(Section, "maxclients", 2, 1, 64, &max_clients) < 1) { + info("[DRV_VNC] no '%s.maxclients' entry from %s using default %d", Section, cfg_source(), max_clients); + } return 0; } @@ -141,9 +150,10 @@ static void drv_vnc_blit_it(const int row, const int col, const int height, cons static void drv_vnc_blit(const int row, const int col, const int height, const int width) { - if (rfbIsActive(server)) { + if (rfbIsActive(server)) { drv_vnc_blit_it(row, col, height, width, (unsigned char *) server->frameBuffer); + if (clientCount > 0) { rfbMarkRectAsModified(server, 0, 0, xres, yres); } @@ -186,7 +196,6 @@ static int drv_vnc_start(const char *section) server->frameBuffer = (char *) malloc(xres * yres * BPP); server->alwaysShared = (1 == 1); server->ptrAddEvent = doptr; -// server->kbdAddEvent = dokey; server->newClientHook = newclient; /* Initialize the server */ |