blob: 115b1d35d9509ac75f911c41c1d81435e93cd397 [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;
george828edfb7a2005-03-03 16:36:10 +000032 rfbSession->interruptFrameDelay();
george826598b742005-01-30 16:47:17 +000033 };
34
35 ~rfbSessionReader() {
george826598b742005-01-30 16:47:17 +000036 }
37
george822b9d03d2005-02-03 14:10:07 +000038 virtual Thread* join() {
george82b4f969b2005-02-09 16:34:51 +000039 ((FbsInputStream*)(rfbSession->getInStream()))->resumePlayback();
george826598b742005-01-30 16:47:17 +000040 fStop = true;
george822b9d03d2005-02-03 14:10:07 +000041 return Thread::join();
george826598b742005-01-30 16:47:17 +000042 }
43
george822b9d03d2005-02-03 14:10:07 +000044 virtual void rfbSessionReader::run() {
george826598b742005-01-30 16:47:17 +000045 // 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};