forked from quickshell/quickshell
fix(socket): clear buffer when closing/opening socket
This commit is contained in:
parent
b42add3967
commit
b5f50cd68f
|
@ -37,7 +37,7 @@ protected:
|
||||||
private slots:
|
private slots:
|
||||||
void onReaderDestroyed();
|
void onReaderDestroyed();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
DataStreamParser* mReader = nullptr;
|
DataStreamParser* mReader = nullptr;
|
||||||
QByteArray buffer;
|
QByteArray buffer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,7 @@ void Socket::setPath(QString path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Socket::onSocketConnected() {
|
void Socket::onSocketConnected() {
|
||||||
|
this->buffer.clear();
|
||||||
this->connected = true;
|
this->connected = true;
|
||||||
this->targetConnected = false;
|
this->targetConnected = false;
|
||||||
this->disconnecting = false;
|
this->disconnecting = false;
|
||||||
|
@ -52,6 +53,7 @@ void Socket::onSocketDisconnected() {
|
||||||
this->disconnecting = false;
|
this->disconnecting = false;
|
||||||
this->socket->deleteLater();
|
this->socket->deleteLater();
|
||||||
this->socket = nullptr;
|
this->socket = nullptr;
|
||||||
|
this->buffer.clear();
|
||||||
emit this->connectionStateChanged();
|
emit this->connectionStateChanged();
|
||||||
|
|
||||||
if (this->targetConnected) this->connectPathSocket();
|
if (this->targetConnected) this->connectPathSocket();
|
||||||
|
|
Loading…
Reference in a new issue