Check socket, and use deleteLater to delete
This commit is contained in:
committed by
Craig Drummond
parent
ee516aa2fe
commit
00fd9d68ff
@@ -261,6 +261,9 @@ void HttpSocket::readClient()
|
||||
}
|
||||
|
||||
QTcpSocket *socket = static_cast<QTcpSocket *>(sender());
|
||||
if (!socket) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (socket->bytesAvailable() >= constMaxBuffer) {
|
||||
// Request too large, reject
|
||||
@@ -412,7 +415,7 @@ void HttpSocket::readClient()
|
||||
socket->close();
|
||||
|
||||
if (QTcpSocket::UnconnectedState==socket->state()) {
|
||||
delete socket;
|
||||
socket->deleteLater();
|
||||
}
|
||||
} else {
|
||||
// Bad Request
|
||||
@@ -489,7 +492,7 @@ void HttpSocket::removedIds(const QSet<qint32> &ids)
|
||||
|
||||
bool HttpSocket::write(QTcpSocket *socket, char *buffer, qint32 bytesRead, bool &stop)
|
||||
{
|
||||
if (bytesRead<0 || terminated || !socket) {
|
||||
if (bytesRead<0 || terminated) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user