diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/protect.h | 30 | ||||
| -rw-r--r-- | include/server.h | 12 |
2 files changed, 38 insertions, 4 deletions
diff --git a/include/protect.h b/include/protect.h new file mode 100644 index 0000000..e0553dd --- /dev/null +++ b/include/protect.h @@ -0,0 +1,30 @@ + +#ifndef PROTECT_H + +#define PROTECT_H + +#include "main.h" +#include "myTimer.h" + +#define PROTECT_PING_INTERVAL_TIMEOUT 5000 +#define PROTECT_SPEED_INTERVAL_TIMEOUT 40 +#define PROTECT_SPEED_AVARAGE 10 + +typedef struct protect_struct +{ + my_time_t lastPing; + + my_time_t lastMove; + my_time_t avarage; + int count; + + bool_t isDown; +} protect_t; + +extern protect_t* newProtect(); +extern void refreshLastMove(protect_t *p); +extern void rereshLastPing(protect_t *p); +extern bool_t isDown(protect_t *p); +extern void destroyProtect(protect_t *p); + +#endif diff --git a/include/server.h b/include/server.h index f1abc8f..24c6e0a 100644 --- a/include/server.h +++ b/include/server.h @@ -9,6 +9,7 @@ #include "tux.h" #include "buffer.h" #include "myTimer.h" +#include "protect.h" #ifndef PUBLIC_SERVER #include "interface.h" @@ -27,7 +28,7 @@ #endif -#define SERVER_TIMEOUT 5000 +#define SERVER_TIMEOUT 1000 #define SERVER_TIME_SYNC 1000 #define SERVER_TIME_PING 1000 #define SERVER_MAX_CLIENTS 100 @@ -45,10 +46,13 @@ typedef struct client_struct sock_sdl_udp_t *socket_sdl_udp; #endif int status; + tux_t *tux; - my_time_t lastPing; - list_t *listCheck; - list_t *buffer; + + protect_t *protect; + + list_t *listSendMsg; + list_t *listRecvMsg; } client_t; #ifdef PUBLIC_SERVER |