blob: f42a9eee0aa1ef66129b84b9c69b103d8610b07c [file] [log] [blame]
george826598b742005-01-30 16:47:17 +00001/* Copyright (C) 2004 TightVNC Team. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
george82ce8dc3a2005-01-31 13:06:54 +000019// -=- rfbSessionReader.h
george826598b742005-01-30 16:47:17 +000020
21#include <rfb/Threading.h>
22
23#include <rfbplayer/RfbProto.h>
24
25using namespace rfb;
26
27class rfbSessionReader : public Thread {
28public:
29 rfbSessionReader(RfbProto *_rfbSession) {
30 rfbSession = _rfbSession;
31 fStop = false;
32 };
33
34 ~rfbSessionReader() {
george826598b742005-01-30 16:47:17 +000035 }
36
george822b9d03d2005-02-03 14:10:07 +000037 virtual Thread* join() {
george826598b742005-01-30 16:47:17 +000038 fStop = true;
george822b9d03d2005-02-03 14:10:07 +000039 return Thread::join();
george826598b742005-01-30 16:47:17 +000040 }
41
george822b9d03d2005-02-03 14:10:07 +000042 virtual void rfbSessionReader::run() {
george826598b742005-01-30 16:47:17 +000043 // Process the rfb messages
44 while (!fStop) {
45 try {
46 rfbSession->processMsg();
47 } catch (rdr::Exception e) {
48 MessageBox(0, e.str(), e.type(), MB_OK | MB_ICONERROR);
49 break;
50 }
51 }
52 }
53
54protected:
55 bool fStop;
56 RfbProto *rfbSession;
57};