Update deleteAllAdhocSockets

This commit is contained in:
AdamN 2024-06-29 00:57:16 +07:00 committed by GitHub
parent 9e8e43f7b7
commit c389ede092
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -429,7 +429,11 @@ void deleteAllAdhocSockets() {
if (fd > 0) {
// Close Socket
shutdown(fd, SD_BOTH);
struct linger sl {};
sl.l_onoff = 1; // non-zero value enables linger option in kernel
sl.l_linger = 0; // timeout interval in seconds
setsockopt(fd, SOL_SOCKET, SO_LINGER, (const char*)&sl, sizeof(sl));
shutdown(fd, SD_RECEIVE);
closesocket(fd);
}
// Free Memory