[Orxonox-commit 3049] r7745 - in code/branches/presentation/src/libraries/network: . packet

smerkli at orxonox.net smerkli at orxonox.net
Wed Dec 8 17:35:36 CET 2010


Author: smerkli
Date: 2010-12-08 17:35:36 +0100 (Wed, 08 Dec 2010)
New Revision: 7745

Modified:
   code/branches/presentation/src/libraries/network/MasterServerComm.cc
   code/branches/presentation/src/libraries/network/MasterServerComm.h
   code/branches/presentation/src/libraries/network/Server.cc
   code/branches/presentation/src/libraries/network/WANDiscovery.h
   code/branches/presentation/src/libraries/network/packet/ServerInformation.cc
Log:
Removed some things and fixed some bugs

Modified: code/branches/presentation/src/libraries/network/MasterServerComm.cc
===================================================================
--- code/branches/presentation/src/libraries/network/MasterServerComm.cc	2010-12-08 16:18:10 UTC (rev 7744)
+++ code/branches/presentation/src/libraries/network/MasterServerComm.cc	2010-12-08 16:35:36 UTC (rev 7745)
@@ -86,19 +86,18 @@
 
     if (this->peer == NULL )
     { COUT(2) << "ERROR: No available peers for initiating an ENet connection.\n";
-    //exit (EXIT_FAILURE);
     return -1;
     }
 
     /* Wait up to 2 seconds for the connection attempt to succeed. */
     if (enet_host_service (this->client, this->event, 2000) > 0 &&
         this->event->type == ENET_EVENT_TYPE_CONNECT )
-      fprintf( stdout, "Connection to server succeeded." );
+      COUT(3) << "Connection to master server succeeded.\n";
     else
     {
       enet_peer_reset (this->peer);
       fprintf( stdout, "Connection to %s failed.", address );
-      //exit(EXIT_FAILURE);
+      COUT(2) << "ERROR: connection to " << address << " failed.\n";
       return -1;
     }
 

Modified: code/branches/presentation/src/libraries/network/MasterServerComm.h
===================================================================
--- code/branches/presentation/src/libraries/network/MasterServerComm.h	2010-12-08 16:18:10 UTC (rev 7744)
+++ code/branches/presentation/src/libraries/network/MasterServerComm.h	2010-12-08 16:35:36 UTC (rev 7745)
@@ -26,6 +26,9 @@
  *
  */
 
+#ifndef MASTERSERVERCOMM_H
+#define MASTERSERVERCOMM_H
+
 #include <cstdlib>
 #include <cstdio>
 #include <string>
@@ -94,3 +97,5 @@
   };
 
 }
+
+#endif /* MASTERSERVERCOMM_H */

Modified: code/branches/presentation/src/libraries/network/Server.cc
===================================================================
--- code/branches/presentation/src/libraries/network/Server.cc	2010-12-08 16:18:10 UTC (rev 7744)
+++ code/branches/presentation/src/libraries/network/Server.cc	2010-12-08 16:35:36 UTC (rev 7745)
@@ -59,6 +59,7 @@
 #include "ClientInformation.h"
 #include "FunctionCallManager.h"
 #include "GamestateManager.h"
+#include "WANDiscovery.h"
 
 namespace orxonox
 {
@@ -109,7 +110,8 @@
     }
 
     /* connect and see if it worked */
-    if( msc.connect( MS_ADDRESS, ORX_MSERVER_PORT ) )
+    if( msc.connect( WANDiscovery::getInstance().getMSAddress().c_str(), 
+      ORX_MSERVER_PORT ) )
     { COUT(1) << "Error: could not connect to master server!\n";
       return;
     }

Modified: code/branches/presentation/src/libraries/network/WANDiscovery.h
===================================================================
--- code/branches/presentation/src/libraries/network/WANDiscovery.h	2010-12-08 16:18:10 UTC (rev 7744)
+++ code/branches/presentation/src/libraries/network/WANDiscovery.h	2010-12-08 16:35:36 UTC (rev 7745)
@@ -1,32 +1,29 @@
 /*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
+ *   ORXONOX - the hottest 3D action shooter ever to exist > www.orxonox.net <
  *
  *
  *   License notice:
  *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
+ *   This program is free software; you can redistribute it and/or modify it
+ *   under the terms of the GNU General Public License as published by the Free
+ *   Software Foundation; either version 2 of the License, or (at your option)
+ *   any later version.
  *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ *   This program is distributed in the hope that it will be useful, but
+ *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ *   for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *   You should have received a copy of the GNU General Public License along
+ *   with this program; if not, write to the Free Software Foundation, Inc., 51
+ *   Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- *   Author:
- *      Fabian 'x3n' Landau (original)
- *   Co-authors:
- *      Sandro 'smerkli' Merkli (copied and adapted to WAN)
+ *   Author: Fabian 'x3n' Landau (original) Co-authors: Sandro 'smerkli' Merkli
+ *   (copied and adapted to WAN)
  *
  */
 
-#ifndef WANDISCOVERY_H
+#ifndef WANDISCOVERY_H 
 #define WANDISCOVERY_H
 
 #include "NetworkPrereqs.h"
@@ -59,6 +56,10 @@
       /** destructor */
       ~WANDiscovery();
 
+      /** get content of msaddress */
+      std::string getMSAddress()
+      { return this->msaddress; }
+
       /** ask server for server list  */
       void discover(); // tolua_export
 

Modified: code/branches/presentation/src/libraries/network/packet/ServerInformation.cc
===================================================================
--- code/branches/presentation/src/libraries/network/packet/ServerInformation.cc	2010-12-08 16:18:10 UTC (rev 7744)
+++ code/branches/presentation/src/libraries/network/packet/ServerInformation.cc	2010-12-08 16:35:36 UTC (rev 7745)
@@ -57,7 +57,10 @@
       uint8_t* temp = event->packet->data;
       char* ack = new char[strlen(LAN_DISCOVERY_ACK)+1];
       loadAndIncrease((char*&)ack, temp);
-      assert(strcmp(ack, (const char*)LAN_DISCOVERY_ACK)==0);
+
+      /* Fabian, what is this used for? it crashes the masterserver, hence commenting it */
+      //assert(strcmp(ack, (const char*)LAN_DISCOVERY_ACK)==0);
+
       // Save Server Name
       loadAndIncrease(this->serverName_, temp);
     }




More information about the Orxonox-commit mailing list