[Orxonox-commit 421] r3003 - in branches/netp3/src/network: . packet
scheusso at orxonox.net
scheusso at orxonox.net
Thu May 21 00:55:44 CEST 2009
Author: scheusso
Date: 2009-05-21 00:55:44 +0200 (Thu, 21 May 2009)
New Revision: 3003
Modified:
branches/netp3/src/network/Client.cc
branches/netp3/src/network/ClientConnection.cc
branches/netp3/src/network/packet/Gamestate.cc
Log:
- fix in connection handling
- reduced debug cpu load on server/client a lot (very inefficient checking for double objectIDs before)
Modified: branches/netp3/src/network/Client.cc
===================================================================
--- branches/netp3/src/network/Client.cc 2009-05-20 20:45:36 UTC (rev 3002)
+++ branches/netp3/src/network/Client.cc 2009-05-20 22:55:44 UTC (rev 3003)
@@ -148,6 +148,7 @@
if(client_connection.isConnected() && isSynched_){
COUT(4) << "popping partial gamestate: " << std::endl;
packet::Gamestate *gs = gamestate.getGamestate();
+ assert(gs);
if(gs){
COUT(4) << "client tick: sending gs " << gs << std::endl;
if( !gs->send() )
Modified: branches/netp3/src/network/ClientConnection.cc
===================================================================
--- branches/netp3/src/network/ClientConnection.cc 2009-05-20 20:45:36 UTC (rev 3002)
+++ branches/netp3/src/network/ClientConnection.cc 2009-05-20 22:55:44 UTC (rev 3003)
@@ -207,6 +207,8 @@
bool ClientConnection::disconnectConnection() {
ENetEvent event;
+ if(this->quit_)
+ return true;
boost::recursive_mutex::scoped_lock lock(enet_mutex_g);
enet_peer_disconnect(server, 0);
while(enet_host_service(client, &event, NETWORK_CLIENT_WAIT_TIME) >= 0){
Modified: branches/netp3/src/network/packet/Gamestate.cc
===================================================================
--- branches/netp3/src/network/packet/Gamestate.cc 2009-05-20 20:45:36 UTC (rev 3002)
+++ branches/netp3/src/network/packet/Gamestate.cc 2009-05-20 22:55:44 UTC (rev 3003)
@@ -178,28 +178,31 @@
assert(b);
}
}
-
// In debug mode, check first, whether there are no duplicate objectIDs
#ifndef NDEBUG
- ObjectList<Synchronisable>::iterator it;
- for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) {
- if (it->getObjectID() == OBJECTID_UNKNOWN) {
- if (it->objectMode_ != 0x0) {
- COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
- COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
- COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
- assert(false);
+ if(this->getID()%1000==0){
+ std::vector<uint32_t> v1;
+ ObjectList<Synchronisable>::iterator it;
+ for (it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ++it) {
+ if (it->getObjectID() == OBJECTID_UNKNOWN) {
+ if (it->objectMode_ != 0x0) {
+ COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
+ COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
+ COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
+ assert(false);
+ }
}
- }
- else {
- ObjectList<Synchronisable>::iterator it2;
- for (it2 = ObjectList<Synchronisable>::begin(); it2 != ObjectList<Synchronisable>::end(); ++it2) {
- if (it->getObjectID() == it2->getObjectID() && *it != *it2) {
- COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
- << "Are you sure you don't create a Sychnronisable objcect with 'new' \
- that doesn't have objectMode = 0x0?" << std::endl;
- assert(false);
+ else {
+ std::vector<uint32_t>::iterator it2;
+ for (it2 = v1.begin(); it2 != v1.end(); ++it2) {
+ if (it->getObjectID() == *it2) {
+ COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
+ << "Are you sure you don't create a Sychnronisable objcect with 'new' \
+ that doesn't have objectMode = 0x0?" << std::endl;
+ assert(false);
+ }
}
+ v1.push_back(it->getObjectID());
}
}
}
More information about the Orxonox-commit
mailing list