aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/CConnection.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/rfb/CConnection.cxx')
-rw-r--r--common/rfb/CConnection.cxx47
1 files changed, 25 insertions, 22 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index eb9972f1..5e7530c8 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -151,11 +151,11 @@ bool CConnection::processMsg()
case RFBSTATE_INITIALISATION: return processInitMsg(); break;
case RFBSTATE_NORMAL: return reader_->readMsg(); break;
case RFBSTATE_CLOSING:
- throw Exception("CConnection::processMsg: called while closing");
+ throw std::logic_error("CConnection::processMsg: Called while closing");
case RFBSTATE_UNINITIALISED:
- throw Exception("CConnection::processMsg: not initialised yet?");
+ throw std::logic_error("CConnection::processMsg: Not initialised yet?");
default:
- throw Exception("CConnection::processMsg: invalid state");
+ throw std::logic_error("CConnection::processMsg: Invalid state");
}
}
@@ -165,7 +165,7 @@ bool CConnection::processVersionMsg()
int majorVersion;
int minorVersion;
- vlog.debug("reading protocol version");
+ vlog.debug("Reading protocol version");
if (!is->hasData(12))
return false;
@@ -176,7 +176,7 @@ bool CConnection::processVersionMsg()
if (sscanf(verStr, "RFB %03d.%03d\n",
&majorVersion, &minorVersion) != 2) {
state_ = RFBSTATE_INVALID;
- throw Exception("reading version failed: not an RFB server?");
+ throw protocol_error("Reading version failed, not an RFB server?");
}
server.setVersion(majorVersion, minorVersion);
@@ -189,8 +189,10 @@ bool CConnection::processVersionMsg()
vlog.error("Server gave unsupported RFB protocol version %d.%d",
server.majorVersion, server.minorVersion);
state_ = RFBSTATE_INVALID;
- throw Exception("Server gave unsupported RFB protocol version %d.%d",
- server.majorVersion, server.minorVersion);
+ throw protocol_error(format("Server gave unsupported RFB protocol "
+ "version %d.%d",
+ server.majorVersion,
+ server.minorVersion));
} else if (server.beforeVersion(3,7)) {
server.setVersion(3,3);
} else if (server.afterVersion(3,8)) {
@@ -213,7 +215,7 @@ bool CConnection::processVersionMsg()
bool CConnection::processSecurityTypesMsg()
{
- vlog.debug("processing security types message");
+ vlog.debug("Processing security types message");
int secType = secTypeInvalid;
@@ -237,7 +239,7 @@ bool CConnection::processSecurityTypesMsg()
secType = secTypeInvalid;
} else {
vlog.error("Unknown 3.3 security type %d", secType);
- throw Exception("Unknown 3.3 security type");
+ throw protocol_error("Unknown 3.3 security type");
}
} else {
@@ -287,7 +289,7 @@ bool CConnection::processSecurityTypesMsg()
if (secType == secTypeInvalid) {
state_ = RFBSTATE_INVALID;
vlog.error("No matching security types");
- throw Exception("No matching security types");
+ throw protocol_error("No matching security types");
}
state_ = RFBSTATE_SECURITY;
@@ -298,7 +300,7 @@ bool CConnection::processSecurityTypesMsg()
bool CConnection::processSecurityMsg()
{
- vlog.debug("processing security message");
+ vlog.debug("Processing security message");
if (!csecurity->processMsg())
return false;
@@ -309,7 +311,7 @@ bool CConnection::processSecurityMsg()
bool CConnection::processSecurityResultMsg()
{
- vlog.debug("processing security result message");
+ vlog.debug("Processing security result message");
int result;
if (server.beforeVersion(3,8) && csecurity->getType() == secTypeNone) {
@@ -325,18 +327,18 @@ bool CConnection::processSecurityResultMsg()
securityCompleted();
return true;
case secResultFailed:
- vlog.debug("auth failed");
+ vlog.debug("Auth failed");
break;
case secResultTooMany:
- vlog.debug("auth failed - too many tries");
+ vlog.debug("Auth failed: Too many tries");
break;
default:
- throw Exception("Unknown security result from server");
+ throw protocol_error("Unknown security result from server");
}
if (server.beforeVersion(3,8)) {
state_ = RFBSTATE_INVALID;
- throw AuthFailureException("Authentication failed");
+ throw auth_error("Authentication failed");
}
state_ = RFBSTATE_SECURITY_REASON;
@@ -345,7 +347,7 @@ bool CConnection::processSecurityResultMsg()
bool CConnection::processSecurityReasonMsg()
{
- vlog.debug("processing security reason message");
+ vlog.debug("Processing security reason message");
if (!is->hasData(4))
return false;
@@ -362,12 +364,12 @@ bool CConnection::processSecurityReasonMsg()
reason[len] = '\0';
state_ = RFBSTATE_INVALID;
- throw AuthFailureException(reason.data());
+ throw auth_error(reason.data());
}
bool CConnection::processInitMsg()
{
- vlog.debug("reading server initialisation");
+ vlog.debug("Reading server initialisation");
return reader_->readServerInit();
}
@@ -391,8 +393,8 @@ void CConnection::close()
*/
try {
decoder.flush();
- } catch (rdr::Exception& e) {
- vlog.error("%s", e.str());
+ } catch (std::exception& e) {
+ vlog.error("%s", e.what());
}
setFramebuffer(nullptr);
@@ -464,7 +466,7 @@ void CConnection::serverInit(int width, int height,
CMsgHandler::serverInit(width, height, pf, name);
state_ = RFBSTATE_NORMAL;
- vlog.debug("initialisation done");
+ vlog.debug("Initialisation done");
initDone();
assert(framebuffer != nullptr);
@@ -922,6 +924,7 @@ void CConnection::updateEncodings()
encodings.push_back(pseudoEncodingContinuousUpdates);
encodings.push_back(pseudoEncodingFence);
encodings.push_back(pseudoEncodingQEMUKeyEvent);
+ encodings.push_back(pseudoEncodingExtendedMouseButtons);
if (Decoder::supported(preferredEncoding)) {
encodings.push_back(preferredEncoding);