mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-06-17 18:50:53 +00:00
shutdown the socket on linux as well
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
// ZeroMemory is just a {0} or a memset(addr, 0, len), and it's a macro on MSVC
|
// ZeroMemory is just a {0} or a memset(addr, 0, len), and it's a macro on MSVC
|
||||||
inline void ZeroMemory(void* dst, size_t len) {
|
inline void ZeroMemory(void* dst, size_t len) {
|
||||||
@@ -16,6 +17,7 @@ inline void ZeroMemory(void* dst, size_t len) {
|
|||||||
}
|
}
|
||||||
// provides unix equivalent of closesocket call in win32
|
// provides unix equivalent of closesocket call in win32
|
||||||
inline void closesocket(int socket) {
|
inline void closesocket(int socket) {
|
||||||
|
shutdown(socket, SHUT_RDWR);
|
||||||
close(socket);
|
close(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ void Check(SOCKET TCPSock, std::reference_wrapper<std::atomic_bool> ok){
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
accum += 100;
|
accum += 100;
|
||||||
if (accum >= 5000) {
|
if (accum >= 5000) {
|
||||||
|
error(Sec("Identification timed out (Check accum)"));
|
||||||
closesocket(TCPSock);
|
closesocket(TCPSock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user