mirror of
https://github.com/QuasarApp/Heart.git
synced 2025-05-13 01:49:41 +00:00
adde new option of the node
This commit is contained in:
parent
be9767267e
commit
9bd6fbe7ae
src/public
@ -533,6 +533,14 @@ bool AbstractNode::configureSslSocket(AbstractNodeInfo *node, bool fServer) {
|
||||
return _socketWorker->run(action);
|
||||
}
|
||||
|
||||
bool AbstractNode::fCloseConnectionAfterBadRequest() const {
|
||||
return _closeConnectionAfterBadRequest;
|
||||
}
|
||||
|
||||
void AbstractNode::setCloseConnectionAfterBadRequest(bool newCloseConnectionAfterBadRequest) {
|
||||
_closeConnectionAfterBadRequest = newCloseConnectionAfterBadRequest;
|
||||
}
|
||||
|
||||
bool AbstractNode::fSendBadRequestErrors() const {
|
||||
return _sendBadRequestErrors;
|
||||
}
|
||||
@ -826,7 +834,8 @@ void AbstractNode::badRequest(const HostAddress &address, const Header &req,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isBanned(getInfoPtr(address))) {
|
||||
auto node = getInfoPtr(address);
|
||||
if (!isBanned(node)) {
|
||||
auto bad = BadRequest(err);
|
||||
if (!sendData(&bad, address, &req)) {
|
||||
return;
|
||||
@ -835,6 +844,10 @@ void AbstractNode::badRequest(const HostAddress &address, const Header &req,
|
||||
QuasarAppUtils::Params::log("Bad request sendet to adderess: " +
|
||||
address.toString(),
|
||||
QuasarAppUtils::Info);
|
||||
|
||||
if (fCloseConnectionAfterBadRequest()) {
|
||||
removeNode(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,6 +407,18 @@ public:
|
||||
*/
|
||||
void setSendBadRequestErrors(bool value);
|
||||
|
||||
/**
|
||||
* @brief fCloseConnectionAfterBadRequest This propery enable or disable droping connection after badRequests. By default it is true.
|
||||
* @return true if the clossing connection is enabled and false if disabled.
|
||||
*/
|
||||
bool fCloseConnectionAfterBadRequest() const;
|
||||
|
||||
/**
|
||||
* @brief setSendBadRequestErrors This method enable or disable the fcloseConnectionAfterBadRequest property.
|
||||
* @param value This is new value of the fcloseConnectionAfterBadRequest property.
|
||||
*/
|
||||
void setCloseConnectionAfterBadRequest(bool value);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief requestError This signal emited when client or node received from remoute server or node the BadRequest package.
|
||||
@ -791,6 +803,7 @@ private:
|
||||
|
||||
QSet<QFutureWatcher <bool>*> _workers;
|
||||
bool _sendBadRequestErrors = true;
|
||||
bool _closeConnectionAfterBadRequest = true;
|
||||
|
||||
mutable QMutex _connectionsMutex;
|
||||
mutable QMutex _confirmNodeMutex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user