summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-27 14:05:34 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-27 14:05:34 +0000
commiteedc1ea625c5c4e4beb633749543e9f57fd55891 (patch)
tree4bd24b0bc28229753805da887fc56c9b59a89d9b /src
parentc25657fc653e07e9186564613a4c3c5f91419013 (diff)
- server dokaze odpovedat na "status" "list" "echo" aj ked je na server prihlasenych maximlny pocet clientov.
- client vypistuje chybove hlasky na chyby "server ping timeout" a "limit max client" git-svn-id: http://opensvn.csie.org/tuxanci_ng@254 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src')
-rw-r--r--src/base/proto.c16
-rw-r--r--src/base/proto.h1
-rw-r--r--src/base/udp_server.c6
3 files changed, 17 insertions, 6 deletions
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;