forked from EXTERNAL/bareiron
support native windows binary compilation
* add winsock2 to globals.c * add winsocket2 compatibility to main function * add winsocket2 to packets.c * and winsocket2 to procedures.c * add winsocket 2 compatibility to tools.c * add winsocket2 to varnum.c * add mingw64 linker options to build.sh * fix build * style nitpicks * remove old_fd * update compilation instructions for windows --------- Co-authored-by: p2r3 <41925384+p2r3@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
#include "tools.h"
|
||||
@@ -181,9 +184,14 @@ void disconnectClient (int *client_fd, int cause) {
|
||||
client_count --;
|
||||
setClientState(*client_fd, STATE_NONE);
|
||||
handlePlayerDisconnect(*client_fd);
|
||||
#ifdef _WIN32
|
||||
closesocket(*client_fd);
|
||||
printf("Disconnected client %d, cause: %d, errno: %d\n", *client_fd, cause, WSAGetLastError());
|
||||
#else
|
||||
close(*client_fd);
|
||||
*client_fd = -1;
|
||||
printf("Disconnected client %d, cause: %d, errno: %d\n\n", *client_fd, cause, errno);
|
||||
#endif
|
||||
*client_fd = -1;
|
||||
}
|
||||
|
||||
uint8_t serverSlotToClientSlot (int window_id, uint8_t slot) {
|
||||
|
Reference in New Issue
Block a user