summaryrefslogtreecommitdiff
path: root/src/publicServer.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-24 15:56:36 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-24 15:56:36 +0000
commit826a768318d071200b289ed3a93ee409759dbae3 (patch)
tree3b3ade45833382db74ab0cb33d8d4327da672bfc /src/publicServer.c
parent13064d1bfc0459be37d8229f3f8c037fb8a10b8f (diff)
- podpora IPv6
- game server je schopny obsluhovat clientov zo sieti IPv4 a IPv6 sucastne - hrac si moze zvolit v nastaveniach, ci che pouzivat IPv4 alebo IPv6 - odkolnenie od SDL_net ( nepodporuje IPv6 ) // ale v kode este podpora SDL_Net je git-svn-id: http://opensvn.csie.org/tuxanci_ng@70 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/publicServer.c')
-rw-r--r--src/publicServer.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/publicServer.c b/src/publicServer.c
index 93ed2a7..7407f3f 100644
--- a/src/publicServer.c
+++ b/src/publicServer.c
@@ -35,8 +35,46 @@ static char *getSetting(char *env, char *param, char *default_val)
return getParamElse(param, getServerConfigFileValue(env, default_val) );
}
+static int initPublicServerNetwork()
+{
+ char ip4[STR_IP_SIZE];
+ char ip6[STR_IP_SIZE];
+ char *p_ip4, *p_ip6;
+ int port4;
+ int port6;
+ int ret;
+
+ ret = -1;
+
+ strcpy(ip4, getSetting("IP4", "--ip4", "none" ) );
+ strcpy(ip6, getSetting("IP6", "--ip6", "none" ) );
+
+ p_ip4 = ip4;
+
+ if( strcmp(ip4, "none") == 0 )
+ {
+ p_ip4 = NULL;
+ }
+
+ p_ip6 = ip6;
+
+ if( strcmp(ip6, "none") == 0 )
+ {
+ p_ip6= NULL;
+ }
+
+ port4 = atoi( getSetting("PORTv4", "--port", "2200") );
+ port6 = atoi( getSetting("PORTv6", "--port", "2200") );
+
+ ret = initNetMulitplayerPublicServer(p_ip4, port4, p_ip6, port6);
+
+ return ret;
+}
+
int initPublicServer()
{
+ int ret;
+
initListID();
initModule();
initArenaFile();
@@ -53,8 +91,9 @@ int initPublicServer()
addNewItem(arena->spaceItem, ID_UNKNOWN);
isSignalEnd = FALSE;
- if( initNetMuliplayer(NET_GAME_TYPE_SERVER,
- getSetting("IP", "--ip", "0.0.0.0") , atoi( getSetting("PORT", "--port", "2200") ) ) < 0 )
+ ret = initPublicServerNetwork();
+
+ if( ret < 0 )
{
printf("Nemozem inicalizovat sietovy socket !\n");
return -1;