[Orxonox-commit 3054] r7750 - code/branches/presentation/src/libraries/network
smerkli at orxonox.net
smerkli at orxonox.net
Wed Dec 8 19:33:12 CET 2010
Author: smerkli
Date: 2010-12-08 19:33:11 +0100 (Wed, 08 Dec 2010)
New Revision: 7750
Modified:
code/branches/presentation/src/libraries/network/MasterServer.cc
code/branches/presentation/src/libraries/network/MasterServerProtocol.h
code/branches/presentation/src/libraries/network/Server.cc
code/branches/presentation/src/libraries/network/WANDiscovery.cc
code/branches/presentation/src/libraries/network/WANDiscovery.h
Log:
documentation.
Modified: code/branches/presentation/src/libraries/network/MasterServer.cc
===================================================================
--- code/branches/presentation/src/libraries/network/MasterServer.cc 2010-12-08 16:56:33 UTC (rev 7749)
+++ code/branches/presentation/src/libraries/network/MasterServer.cc 2010-12-08 18:33:11 UTC (rev 7750)
@@ -60,7 +60,6 @@
for( i = mainlist.serverlist.begin(); i
!= mainlist.serverlist.end(); ++i )
{
- /* WORK MARK */
/* send this particular server */
/* build reply string */
char *tosend = (char *)calloc( (*i).getServerIP().length()
@@ -87,11 +86,12 @@
free( tosend );
}
- /* send end-of-list packet */
+ /* create end-of-list packet */
reply = enet_packet_create( MSPROTO_SERVERLIST_END,
MSPROTO_SERVERLIST_END_LEN + 1,
ENET_PACKET_FLAG_RELIABLE );
+ /* send end-of-list packet */
enet_peer_send( event->peer, 0, reply );
/* One could just use enet_host_service() instead. */
@@ -158,7 +158,6 @@
MasterServer::eventData( ENetEvent *event )
{ /* validate packet */
if( !event || !(event->packet) || !(event->peer) )
- //|| !(event->packet->data) || !strlen(event->packet->data) )
{ COUT(2) << "No complete event given.\n";
return -1;
}
@@ -167,8 +166,7 @@
char *addrconv = (char *) calloc( 50, 1 );
enet_address_get_host_ip( &(event->peer->address), addrconv, 49 );
- /* DEBUG */
- /* output debug info about the data that has come, to be removed */
+ /* output debug info about the data that has come */
helper_output_debug( event, addrconv );
/* GAME SERVER OR CLIENT CONNECTION? */
@@ -274,7 +272,6 @@
}
/***** INITIALIZE GAME SERVER AND PEER LISTS *****/
- //this->mainlist = new ServerList();
this->peers = new PeerList();
/* tell people we're now initialized */
@@ -291,7 +288,6 @@
/* free all used memory */
/* clear the list of connected game servers */
/* clear the list of connected game clients */
-
}
/* end of namespace */
Modified: code/branches/presentation/src/libraries/network/MasterServerProtocol.h
===================================================================
--- code/branches/presentation/src/libraries/network/MasterServerProtocol.h 2010-12-08 16:56:33 UTC (rev 7749)
+++ code/branches/presentation/src/libraries/network/MasterServerProtocol.h 2010-12-08 18:33:11 UTC (rev 7750)
@@ -32,38 +32,46 @@
/* master server address (to be moved elsewhere later) */
#define MS_ADDRESS "129.132.3.8"
+/* Client token (shows that the party sending data is a client */
#define MSPROTO_CLIENT "CL"
#define MSPROTO_CLIENT_LEN 2
+/* Request: Serverlist (requiest made from client to master server */
#define MSPROTO_REQ_LIST "REQ:LIST"
#define MSPROTO_REQ_LIST_LEN 8
+/* Game server token (shows that the party sending data is a game server) */
#define MSPROTO_GAME_SERVER "GS"
#define MSPROTO_GAME_SERVER_LEN 2
+/* Register game server at the master server, meaning request to be taken into$
+ * the master servers game server list.
+ */
#define MSPROTO_REGISTER_SERVER "REG:SER"
#define MSPROTO_REGISTER_SERVER_LEN 7
+/* Server list item token */
#define MSPROTO_SERVERLIST_ITEM "SI"
#define MSPROTO_SERVERLIST_ITEM_LEN 2
+
+/* server list end token */
#define MSPROTO_SERVERLIST_END "SL_END"
#define MSPROTO_SERVERLIST_END_LEN 6
-
-
-
+/* default master server port */
#define ORX_MSERVER_PORT 55566
+/* some constants for the networking of the master server, not very important.
+ * play with those if things don't work out well.$
+ */
#define ORX_MSERVER_MAXCONNS 32
#define ORX_MSERVER_MAXCHANS 2
-
-
#endif /* MASTER_SERVER_PROTO */
Modified: code/branches/presentation/src/libraries/network/Server.cc
===================================================================
--- code/branches/presentation/src/libraries/network/Server.cc 2010-12-08 16:56:33 UTC (rev 7749)
+++ code/branches/presentation/src/libraries/network/Server.cc 2010-12-08 18:33:11 UTC (rev 7750)
@@ -100,7 +100,7 @@
}
- /* TODO */
+ /** helper that connects to the master server */
void Server::helper_ConnectToMasterserver()
{
/* initialize it and see if it worked */
@@ -172,6 +172,7 @@
int rephandler( char *addr, ENetEvent *ev )
{
/* handle incoming data */
+ /* TODO this is to be implemented. */
/* done handling, return all ok code 0 */
return 0;
@@ -179,6 +180,9 @@
void Server::helper_HandleMasterServerRequests()
{
+ /* poll the master server for replies and see whether something
+ * has to be done or changed.
+ */
this->msc.pollForReply( rephandler );
}
Modified: code/branches/presentation/src/libraries/network/WANDiscovery.cc
===================================================================
--- code/branches/presentation/src/libraries/network/WANDiscovery.cc 2010-12-08 16:56:33 UTC (rev 7749)
+++ code/branches/presentation/src/libraries/network/WANDiscovery.cc 2010-12-08 18:33:11 UTC (rev 7750)
@@ -46,10 +46,10 @@
/* debugging output */
COUT(4) << "Creating WANDiscovery.\n";
- /* register object with orxonox main class */
+ /* register object in orxonox */
RegisterObject(WANDiscovery);
- /* ... and register a config value function for it */
+ /* check for the masterserver address option in orxonox.ini */
this->setConfigValues();
/* initialize it and see if it worked */
@@ -67,6 +67,9 @@
void WANDiscovery::setConfigValues()
{
+ /* update msaddress string from orxonox.ini config file, if it
+ * has changed.
+ */
SetConfigValue( msaddress, "localhost");
}
Modified: code/branches/presentation/src/libraries/network/WANDiscovery.h
===================================================================
--- code/branches/presentation/src/libraries/network/WANDiscovery.h 2010-12-08 16:56:33 UTC (rev 7749)
+++ code/branches/presentation/src/libraries/network/WANDiscovery.h 2010-12-08 18:33:11 UTC (rev 7750)
@@ -56,7 +56,10 @@
/** destructor */
~WANDiscovery();
- /** get content of msaddress */
+ /** \return Address of the master server
+ *
+ * Get the master server address
+ */
std::string getMSAddress()
{ return this->msaddress; }
More information about the Orxonox-commit
mailing list