Fixed hanging bug

This commit is contained in:
Ryzerth 2021-07-19 15:57:37 +02:00
parent 1adcdea6d1
commit 027297933b
2 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,7 @@ namespace net {
#ifdef _WIN32 #ifdef _WIN32
closesocket(_sock); closesocket(_sock);
#else #else
::shutdown(_sock, SHUT_RDWR);
::close(_sock); ::close(_sock);
#endif #endif
} }

View File

@ -11,6 +11,8 @@ namespace spyserver {
client = std::move(conn); client = std::move(conn);
output = out; output = out;
output->clearWriteStop();
sendHandshake("SDR++"); sendHandshake("SDR++");
client->readAsync(sizeof(SpyServerMessageHeader), (uint8_t*)&receivedHeader, dataHandler, this); client->readAsync(sizeof(SpyServerMessageHeader), (uint8_t*)&receivedHeader, dataHandler, this);
@ -31,6 +33,7 @@ namespace spyserver {
} }
void SpyServerClientClass::close() { void SpyServerClientClass::close() {
output->stopWriter();
client->close(); client->close();
} }