瀏覽代碼

Throw exception instead on bad access check

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.
pull/1611/head
Pierre Ossman 1 年之前
父節點
當前提交
6b7a69e807
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      common/rfb/SConnection.cxx

+ 2
- 2
common/rfb/SConnection.cxx 查看文件

@@ -23,7 +23,6 @@

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/clipboardTypes.h>
@@ -347,7 +346,8 @@ void SConnection::setAccessRights(AccessRights ar)

bool SConnection::accessCheck(AccessRights ar) const
{
assert(state_ >= RFBSTATE_QUERYING);
if (state_ < RFBSTATE_QUERYING)
throw Exception("SConnection::accessCheck: invalid state");

return (accessRights & ar) == ar;
}

Loading…
取消
儲存