mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator
synced 2025-07-06 22:42:19 +08:00
Add a common include file.
This commit is contained in:
@ -17,22 +17,6 @@
|
||||
|
||||
#include "network.h"
|
||||
|
||||
#if defined(STEAM_WIN32)
|
||||
|
||||
#define MSG_NOSIGNAL 0
|
||||
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#define MAX_BROADCASTS 16
|
||||
static int number_broadcasts = -1;
|
||||
static IP_PORT broadcasts[MAX_BROADCASTS];
|
||||
@ -45,8 +29,6 @@ static uint32_t upper_range_ips[MAX_BROADCASTS];
|
||||
|
||||
#if defined(STEAM_WIN32)
|
||||
|
||||
#include <iphlpapi.h>
|
||||
|
||||
//windows xp support
|
||||
static int
|
||||
inet_pton4(const char *src, uint32_t *dst)
|
||||
@ -489,18 +471,6 @@ static bool recv_tcp(struct TCP_Socket &socket)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check_timedout(std::chrono::high_resolution_clock::time_point old, double timeout)
|
||||
{
|
||||
if (timeout == 0.0) return true;
|
||||
|
||||
std::chrono::high_resolution_clock::time_point now = std::chrono::high_resolution_clock::now();
|
||||
if (std::chrono::duration_cast<std::chrono::duration<double>>(now - old).count() > timeout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void socket_timeouts(struct TCP_Socket &socket, double extra_time)
|
||||
{
|
||||
if (check_timedout(socket.last_heartbeat_sent, HEARTBEAT_TIMEOUT / 2.0)) {
|
||||
|
Reference in New Issue
Block a user