summaryrefslogtreecommitdiff
path: root/src/server.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-17 20:29:34 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-17 20:29:34 +0000
commit437da38a26548714e6e1640722148f0f9f601ccb (patch)
tree3bc6a5a0903211e2d1ffa4fd9b3e6e467d413ecf /src/server.c
parent51aae47ae08ad61507f219c24ed6d9321c866f45 (diff)
<Oroborus> - opravena chyba, clent nacital iba _jeden_ sietovy packet za 50 ms ( ano aj ked ich prislo viacej)
<Oroborus> - server pinguje clientov a na zaklade toho client vie, ci server nespadol <Oroborus> - publicserver sa da korektne vypnut signalom SIGQUIT <Oroborus> - publicserver bol pretiahnuty cez valgrind, teraz za pocet volani funkcie malloc rovna poctu volani funkcie free <Oroborus> - v sietovom multiplayeri sa da chodit cez teleporty a strielat do teleportov <Oroborus> - do rur sa da siez strielat git-svn-id: http://opensvn.csie.org/tuxanci_ng@24 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/server.c b/src/server.c
index 032a210..2a259c5 100644
--- a/src/server.c
+++ b/src/server.c
@@ -3,6 +3,12 @@
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
#include "list.h"
#include "tux.h"
#include "network.h"
@@ -44,7 +50,7 @@ static my_time_t lastSyncClient;
void static initServer()
{
listClient = newList();
- lastSyncClient = getMyTime();
+ lastSyncClient = getMyTime();
}
#ifdef SUPPORT_NET_UNIX_TCP
@@ -495,6 +501,8 @@ void eventPeriodicSyncClient()
client_t *thisClientSend;
tux_t *thisTux;
int i, j;
+
+ proto_send_ping_server();
#ifndef BUBLIC_SERVER
proto_send_newtux_server(NULL,
@@ -557,6 +565,7 @@ static void eventClientUdpSelect(sock_udp_t *sock_server)
isCreateNewClient = FALSE;
memset(buffer, 0, STR_SIZE);
+
ret = readUdpSocket(sock_server, sock_client, buffer, STR_SIZE-1);
client = findUdpClient(sock_client);
@@ -597,6 +606,7 @@ void selectServerUdpSocket()
struct timeval tv;
fd_set readfds;
int max_fd;
+ int ret;
#ifndef BUBLIC_SERVER
tv.tv_sec = 0;
@@ -614,7 +624,12 @@ void selectServerUdpSocket()
delZombieCLient();
- select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv);
+ ret = select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv);
+
+ if( ret < 0 )
+ {
+ return;
+ }
/*
printf("%d\n", tv.tv_usec);