From 7b90c44708b6b3096419af747e4a4f3470d2d4db Mon Sep 17 00:00:00 2001 From: dscho Date: Thu, 17 Jan 2002 09:33:17 +0000 Subject: correct BackChannel handling, compile cleanups --- rfbserver.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'rfbserver.c') diff --git a/rfbserver.c b/rfbserver.c index 94533f3..b938d91 100644 --- a/rfbserver.c +++ b/rfbserver.c @@ -709,6 +709,15 @@ rfbProcessClientNormalMessage(cl) cl->enableLastRectEncoding = TRUE; } break; +#ifdef BACKCHANNEL + case rfbEncodingBackChannel: + if (!cl->enableBackChannel) { + rfbLog("Enabling BackChannel protocol extension for " + "client %s\n", cl->host); + cl->enableBackChannel = TRUE; + } + break; +#endif default: if ( enc >= (CARD32)rfbEncodingCompressLevel0 && enc <= (CARD32)rfbEncodingCompressLevel9 ) { @@ -1470,18 +1479,20 @@ void rfbSendBackChannel(rfbScreenInfoPtr rfbScreen,char* str,int len) iterator = rfbGetClientIterator(rfbScreen); while ((cl = rfbClientIteratorNext(iterator)) != NULL) { - sct.type = rfbBackChannel; - sct.length = Swap32IfLE(len); - if (WriteExact(cl, (char *)&sct, - sz_rfbServerCutTextMsg) < 0) { - rfbLogPerror("rfbSendServerCutText: write"); - rfbCloseClient(cl); - continue; - } - if (WriteExact(cl, str, len) < 0) { - rfbLogPerror("rfbSendServerCutText: write"); - rfbCloseClient(cl); - } + if (cl->enableBackChannel) { + sct.type = rfbBackChannel; + sct.length = Swap32IfLE(len); + if (WriteExact(cl, (char *)&sct, + sz_rfbBackChannelMsg) < 0) { + rfbLogPerror("rfbSendBackChannel: write"); + rfbCloseClient(cl); + continue; + } + if (WriteExact(cl, str, len) < 0) { + rfbLogPerror("rfbSendBackChannel: write"); + rfbCloseClient(cl); + } + } } rfbReleaseClientIterator(iterator); } -- cgit v1.2.1