diff --git a/src/aoclient.cpp b/src/aoclient.cpp index 08522a3..c7b35fa 100644 --- a/src/aoclient.cpp +++ b/src/aoclient.cpp @@ -27,6 +27,7 @@ AOClient::AOClient(Server* p_server, QTcpSocket* p_socket, QObject* parent) current_area = 0; current_char = ""; remote_ip = p_socket->peerAddress(); + is_partial = false; } void AOClient::clientData() diff --git a/src/ws_client.cpp b/src/ws_client.cpp index 2e39c4e..d77321d 100644 --- a/src/ws_client.cpp +++ b/src/ws_client.cpp @@ -43,10 +43,14 @@ void WSClient::onTcpData() void WSClient::onWsDisconnect() { - tcp_socket->disconnectFromHost(); + if (tcp_socket != nullptr) + tcp_socket->disconnectFromHost(); } void WSClient::onTcpDisconnect() { + qDebug() << "deleted"; web_socket->close(); + tcp_socket->deleteLater(); + web_socket->deleteLater(); } diff --git a/src/ws_proxy.cpp b/src/ws_proxy.cpp index 92f8c92..e0862aa 100644 --- a/src/ws_proxy.cpp +++ b/src/ws_proxy.cpp @@ -46,8 +46,8 @@ void WSProxy::wsConnected() connect(new_ws, &QWebSocket::textMessageReceived, client, &WSClient::onWsData); connect(new_tcp, &QTcpSocket::readyRead, client, &WSClient::onTcpData); connect(new_ws, &QWebSocket::disconnected, client, &WSClient::onWsDisconnect); - connect(new_tcp, &QTcpSocket::disconnected, client, &WSClient::onTcpDisconnect); connect(new_tcp, &QTcpSocket::disconnected, this, [=] { + client->onTcpDisconnect(); clients.removeAll(client); client->deleteLater(); });