summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/conf/server.conf2
-rw-r--r--src/base/proto.c16
-rw-r--r--src/base/proto.h1
-rw-r--r--src/base/udp_server.c6
4 files changed, 18 insertions, 7 deletions
diff --git a/data/conf/server.conf b/data/conf/server.conf
index 933f424..c8aaef2 100644
--- a/data/conf/server.conf
+++ b/data/conf/server.conf
@@ -15,4 +15,4 @@ MAX_ITEM 10
LOG_FILE tuxanci-server.log
SCORE_FILE height-score.txt
-SUPPORT_CLIENTS test 0.20.0 svn195 svn194 svn193 svn192 svn191 svn190
+SUPPORT_CLIENTS test 0.20.0 svn
diff --git a/src/base/proto.c b/src/base/proto.c
index e833225..9362378 100644
--- a/src/base/proto.c
+++ b/src/base/proto.c
@@ -72,6 +72,14 @@ void proto_recv_error_client(char *msg)
setMsgToAnalyze(_("Version of your client isn't supported by the server."));
setWorldEnd();
break;
+ case PROTO_ERROR_CODE_TIMEOUT :
+ setMsgToAnalyze(_("The timeout of ping from server is out"));
+ setWorldEnd();
+ break;
+ case PROTO_ERROR_LIMIT_MAX_CLIENT :
+ setMsgToAnalyze(_("The maximum amount of connected players has been exceeded!"));
+ setWorldEnd();
+ break;
}
}
@@ -143,6 +151,14 @@ void proto_recv_hello_server(client_t *client, char *msg)
assert( client != NULL );
+ if( getSpaceCount(getCurrentArena()->spaceTux)+1 > getServerMaxClients() )
+ {
+ proto_send_error_server(PROTO_SEND_ONE, client, PROTO_ERROR_LIMIT_MAX_CLIENT);
+ eventMsgInCheckFront(client);
+ client->status = NET_STATUS_ZOMBIE;
+ return;
+ }
+
strcpy(version, "");
strcpy(name, "");
diff --git a/src/base/proto.h b/src/base/proto.h
index 9e2b666..614faa9 100644
--- a/src/base/proto.h
+++ b/src/base/proto.h
@@ -33,6 +33,7 @@
#define PROTO_ERROR_CODE_BAD_NAME 2
#define PROTO_ERROR_CODE_BAD_COMMAND 3
#define PROTO_ERROR_CODE_TIMEOUT 4
+#define PROTO_ERROR_LIMIT_MAX_CLIENT 5
extern void proto_send_error_server(int type, client_t *client, int errorcode);
extern void proto_recv_error_client(char *msg);
diff --git a/src/base/udp_server.c b/src/base/udp_server.c
index 1923e55..afe0cba 100644
--- a/src/base/udp_server.c
+++ b/src/base/udp_server.c
@@ -192,12 +192,6 @@ static void eventClientUdpSelect(sock_udp_t *sock_server)
if( client == NULL )
{
- if( getSpaceCount(getCurrentArena()->spaceTux)+1 > getServerMaxClients() )
- {
- destroySockUdp(sock_client);
- return;
- }
-
eventCreateNewUdpClient(sock_client);
client = findUdpClient(sock_client);
isCreateNewClient = TRUE;