An assert will kill the entire server, which is overly harsh when there
is a problem with a single connection. Instead, throw an exception which
will just disconnect that specific client.
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/clipboardTypes.h>
bool SConnection::accessCheck(AccessRights ar) const
{
- assert(state_ >= RFBSTATE_QUERYING);
+ if (state_ < RFBSTATE_QUERYING)
+ throw Exception("SConnection::accessCheck: invalid state");
return (accessRights & ar) == ar;
}