浏览代码

Remove writeConnFailedFromScratch()

It is static and only used from a single place, so let's inline it.
tags/v1.9.90
Pierre Ossman 5 年前
父节点
当前提交
4bba2467fb
共有 3 个文件被更改,包括 7 次插入18 次删除
  1. 0
    9
      common/rfb/SConnection.cxx
  2. 0
    7
      common/rfb/SConnection.h
  3. 7
    2
      common/rfb/VNCServerST.cxx

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

@@ -260,15 +260,6 @@ void SConnection::throwConnFailedException(const char* format, ...)
throw ConnFailedException(str);
}

void SConnection::writeConnFailedFromScratch(const char* msg,
rdr::OutStream* os)
{
os->writeBytes("RFB 003.003\n", 12);
os->writeU32(0);
os->writeString(msg);
os->flush();
}

void SConnection::setAccessRights(AccessRights ar)
{
accessRights = ar;

+ 0
- 7
common/rfb/SConnection.h 查看文件

@@ -154,13 +154,6 @@ namespace rfb {
// ConnFailedException.
void throwConnFailedException(const char* format, ...) __printf_attr(2, 3);

// writeConnFailedFromScratch() sends a conn failed message to an OutStream
// without the need to negotiate the protocol version first. It actually
// does this by assuming that the client will understand version 3.3 of the
// protocol.
static void writeConnFailedFromScratch(const char* msg,
rdr::OutStream* os);

SMsgReader* reader() { return reader_; }
SMsgWriter* writer() { return writer_; }


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

@@ -126,8 +126,13 @@ void VNCServerST::addSocket(network::Socket* sock, bool outgoing)
if (blHosts->isBlackmarked(address.buf)) {
connectionsLog.error("blacklisted: %s", address.buf);
try {
SConnection::writeConnFailedFromScratch("Too many security failures",
&sock->outStream());
rdr::OutStream& os = sock->outStream();

// Shortest possible way to tell a client it is not welcome
os.writeBytes("RFB 003.003\n", 12);
os.writeU32(0);
os.writeString("Too many security failures");
os.flush();
} catch (rdr::Exception&) {
}
sock->shutdown();

正在加载...
取消
保存