summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-09-23 12:20:32 +0200
committerPierre Ossman <ossman@cendio.se>2015-09-23 12:20:32 +0200
commit1db732494b625df465797faaec3d76d535e69d43 (patch)
treec04da6ff9ccc49aab26f890d840327af9b4e94c8
parentd9b9003d977f8aaf37010c70bdac0b827749d554 (diff)
downloadtigervnc-1db732494b625df465797faaec3d76d535e69d43.tar.gz
tigervnc-1db732494b625df465797faaec3d76d535e69d43.zip
Terminate the viewer even when waiting for data
It should be possible to exit the viewer even if the network has stalled in the middle of a transfer.
-rw-r--r--vncviewer/CConn.cxx8
-rw-r--r--vncviewer/vncviewer.cxx5
-rw-r--r--vncviewer/vncviewer.h1
3 files changed, 13 insertions, 1 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 2acb373e..686ce30d 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -240,6 +240,9 @@ void CConn::blockCallback()
next_timer = INT_MAX;
Fl::wait((double)next_timer / 1000.0);
+
+ if (should_exit())
+ throw rdr::Exception("Termination requested");
}
void CConn::socketEvent(FL_SOCKET fd, void *data)
@@ -267,7 +270,10 @@ void CConn::socketEvent(FL_SOCKET fd, void *data)
exit_vncviewer();
} catch (rdr::Exception& e) {
vlog.error("%s", e.str());
- exit_vncviewer(e.str());
+ // Somebody might already have requested us to terminate, and
+ // might have already provided an error message.
+ if (!should_exit())
+ exit_vncviewer(e.str());
}
recursing = false;
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index 4b989bb2..f9258b90 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -117,6 +117,11 @@ void exit_vncviewer(const char *error)
exitMainloop = true;
}
+bool should_exit()
+{
+ return exitMainloop;
+}
+
void about_vncviewer()
{
fl_message_title(_("About TigerVNC Viewer"));
diff --git a/vncviewer/vncviewer.h b/vncviewer/vncviewer.h
index 089fb270..4d0566bb 100644
--- a/vncviewer/vncviewer.h
+++ b/vncviewer/vncviewer.h
@@ -22,6 +22,7 @@
#define VNCSERVERNAMELEN 64
void exit_vncviewer(const char *error = NULL);
+bool should_exit();
void about_vncviewer();
#endif