diff options
Diffstat (limited to 'rfbserver.c')
-rw-r--r-- | rfbserver.c | 35 |
1 files changed, 23 insertions, 12 deletions
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); } |