diff options
Diffstat (limited to 'common/rfb/CConnection.cxx')
-rw-r--r-- | common/rfb/CConnection.cxx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index a682b810..e8451337 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -147,11 +147,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"); } } @@ -172,7 +172,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); @@ -185,8 +185,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)) { @@ -233,7 +235,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 { @@ -283,7 +285,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; @@ -327,12 +329,12 @@ bool CConnection::processSecurityResultMsg() 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; @@ -358,7 +360,7 @@ bool CConnection::processSecurityReasonMsg() reason[len] = '\0'; state_ = RFBSTATE_INVALID; - throw AuthFailureException(reason.data()); + throw auth_error(reason.data()); } bool CConnection::processInitMsg() @@ -387,8 +389,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); @@ -835,6 +837,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); |