mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add 'discardAll' parameter to socket:close(...)
This commit is contained in:
parent
20bd7666cd
commit
d2bbd82dbe
3 changed files with 11 additions and 6 deletions
|
|
@ -400,10 +400,15 @@ public:
|
|||
return readBatch.size();
|
||||
}
|
||||
|
||||
void close() override {
|
||||
if (state != ConnectionState::CLOSED) {
|
||||
shutdown(descriptor, 2);
|
||||
closesocket(descriptor);
|
||||
void close(bool discardAll=false) override {
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
readBatch.clear();
|
||||
|
||||
if (state != ConnectionState::CLOSED) {
|
||||
shutdown(descriptor, 2);
|
||||
closesocket(descriptor);
|
||||
}
|
||||
}
|
||||
if (thread) {
|
||||
thread->join();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue