fix(socket): clear buffer when closing/opening socket

This commit is contained in:
outfoxxed 2024-03-03 15:37:31 -08:00
parent b42add3967
commit b5f50cd68f
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 3 additions and 1 deletions

View file

@ -37,7 +37,7 @@ protected:
private slots:
void onReaderDestroyed();
private:
protected:
DataStreamParser* mReader = nullptr;
QByteArray buffer;
};

View file

@ -41,6 +41,7 @@ void Socket::setPath(QString path) {
}
void Socket::onSocketConnected() {
this->buffer.clear();
this->connected = true;
this->targetConnected = false;
this->disconnecting = false;
@ -52,6 +53,7 @@ void Socket::onSocketDisconnected() {
this->disconnecting = false;
this->socket->deleteLater();
this->socket = nullptr;
this->buffer.clear();
emit this->connectionStateChanged();
if (this->targetConnected) this->connectPathSocket();