blob: 06941b1e3ed0378466c417391b123824c1624d04 [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() {
35 fStop = true;
36 delete join();
37 }
38
39 void stop() {
40 fStop = true;
41 }
42
43 void rfbSessionReader::run() {
44 fStop = false;
45 // Process the rfb messages
46 while (!fStop) {
47 try {
48 rfbSession->processMsg();
49 } catch (rdr::Exception e) {
50 MessageBox(0, e.str(), e.type(), MB_OK | MB_ICONERROR);
51 break;
52 }
53 }
54 }
55
56protected:
57 bool fStop;
58 RfbProto *rfbSession;
59};