It is static and only used from a single place, so let's inline it.tags/v1.9.90
throw ConnFailedException(str); | 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) | void SConnection::setAccessRights(AccessRights ar) | ||||
{ | { | ||||
accessRights = ar; | accessRights = ar; |
// ConnFailedException. | // ConnFailedException. | ||||
void throwConnFailedException(const char* format, ...) __printf_attr(2, 3); | 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_; } | SMsgReader* reader() { return reader_; } | ||||
SMsgWriter* writer() { return writer_; } | SMsgWriter* writer() { return writer_; } | ||||
if (blHosts->isBlackmarked(address.buf)) { | if (blHosts->isBlackmarked(address.buf)) { | ||||
connectionsLog.error("blacklisted: %s", address.buf); | connectionsLog.error("blacklisted: %s", address.buf); | ||||
try { | 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&) { | } catch (rdr::Exception&) { | ||||
} | } | ||||
sock->shutdown(); | sock->shutdown(); |