blob: 31985bc50b7ee40c90b947bfb1f84efe55b2a351 [file] [log] [blame]
Constantin Kaplinsky729598c2006-05-25 05:12:25 +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
19// -=- rfbSessionReader.h
20
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 rfbSession->interruptFrameDelay();
33 };
34
35 ~rfbSessionReader() {
36 }
37
38 virtual Thread* join() {
39 ((FbsInputStream*)(rfbSession->getInStream()))->resumePlayback();
40 fStop = true;
41 return Thread::join();
42 }
43
44 virtual void rfbSessionReader::run() {
45 // Process the rfb messages
46 while (!fStop) {
47 try {
48 rfbSession->processMsg();
49 } catch (rdr::Exception e) {
50 MessageBox(0, e.str(), "RFB Player", MB_OK | MB_ICONERROR);
51 break;
52 }
53 }
54 }
55
56protected:
57 bool fStop;
58 RfbProto *rfbSession;
59};