Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1278 for code/branches/merge


Ignore:
Timestamp:
May 15, 2008, 10:09:02 AM (17 years ago)
Author:
scheusso
Message:

new dummy[server,client]4; adapted connectionmanager to new boost::thread syntax

Location:
code/branches/merge
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/merge/CMakeLists.txt

    r1264 r1278  
    2222
    2323OPTION(NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike")
     24OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Do you want to build dummyserver4 and dummyclient4")
    2425
    2526
  • code/branches/merge/src/network/CMakeLists.txt

    r1264 r1278  
    5555  ##### end test for gamestate stuff #####
    5656ENDIF(NETWORK_TESTING_ENABLED)
     57# build this if you want dummyserver4 and dummyclient4
     58IF(NETWORKTRAFFIC_TESTING_ENABLED)
     59  ##### test network traffic #####
     60  SET( DUMMYSERVER4_SRC_FILES
     61    ConnectionManager.cc
     62    GameStateManager.cc
     63    PacketBuffer.cc
     64    PacketDecoder.cc
     65    PacketGenerator.cc
     66    ClientConnection.cc
     67    ClientInformation.cc
     68    GameStateClient.cc
     69    Server.cc
     70    Client.cc 
     71    Synchronisable.cc
     72    dummyserver4.cc
     73  )
     74
     75  SET( DUMMYCLIENT4_SRC_FILES
     76    ConnectionManager.cc
     77    GameStateManager.cc
     78    PacketBuffer.cc
     79    PacketDecoder.cc
     80    PacketGenerator.cc
     81    ClientConnection.cc
     82    ClientInformation.cc
     83    GameStateClient.cc
     84    Server.cc
     85    Client.cc 
     86    Synchronisable.cc
     87    dummyclient4.cc
     88  )
     89
     90  ADD_EXECUTABLE(dummyserver4 ${DUMMYSERVER4_SRC_FILES})
     91  TARGET_LINK_LIBRARIES( dummyserver4
     92    network
     93    ${ENet_LIBRARY}
     94    ${ZLIB_LIBRARY}
     95    ${WINDOWS_ENET_DEPENDENCIES}
     96    ${Boost_thread_LIBRARIES}
     97    core
     98    orxonoxs
     99    audio
     100  )
     101
     102  ADD_EXECUTABLE(dummyclient4 ${DUMMYCLIENT4_SRC_FILES})
     103  TARGET_LINK_LIBRARIES( dummyclient4
     104    network
     105    ${ENet_LIBRARY}
     106    ${ZLIB_LIBRARY}
     107    ${WINDOWS_ENET_DEPENDENCIES}
     108    ${Boost_thread_LIBRARIES}
     109    core
     110    orxonoxs
     111    audio
     112  )
     113ENDIF(NETWORKTRAFFIC_TESTING_ENABLED)
     114
    57115IF(BLABLA)
    58116  SET( CHATCLIENT_SRC_FILES
  • code/branches/merge/src/network/ConnectionManager.cc

    r1264 r1278  
    4040#include <iostream>
    4141// boost.thread library for multithreading support
    42 #include <boost/thread/thread.hpp>
    4342#include <boost/bind.hpp>
    4443
     
    6362namespace network
    6463{
    65   boost::thread_group network_threads;
    66  
    67   ConnectionManager::ConnectionManager(){}
    68  
    69   ConnectionManager::ConnectionManager(ClientInformation *head) {
     64  //boost::thread_group network_threads;
     65 
     66  ConnectionManager::ConnectionManager():receiverThread_(0){}
     67 
     68  ConnectionManager::ConnectionManager(ClientInformation *head) : receiverThread_(0) {
    7069    quit=false;
    7170    bindAddress.host = ENET_HOST_ANY;
     
    7473  }
    7574
    76   ConnectionManager::ConnectionManager(int port, std::string address, ClientInformation *head) {
     75  ConnectionManager::ConnectionManager(int port, std::string address, ClientInformation *head) :receiverThread_(0) {
    7776    quit=false;
    7877    enet_address_set_host (& bindAddress, address.c_str());
     
    8180  }
    8281
    83   ConnectionManager::ConnectionManager(int port, const char *address, ClientInformation *head) {
     82  ConnectionManager::ConnectionManager(int port, const char *address, ClientInformation *head) : receiverThread_(0) {
    8483    quit=false;
    8584    enet_address_set_host (& bindAddress, address);
     
    111110
    112111  void ConnectionManager::createListener() {
    113     network_threads.create_thread(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this));
    114     //     boost::thread thr(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this));
     112    receiverThread_ = new boost::thread(boost::bind(&ConnectionManager::receiverThread, this));
     113    //network_threads.create_thread(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this));
     114         //boost::thread thr(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this));
    115115    return;
    116116  }
     
    118118  bool ConnectionManager::quitListener() {
    119119    quit=true;
    120     network_threads.join_all();
     120    //network_threads.join_all();
     121    receiverThread_->join();
    121122    return true;
    122123  }
     
    202203      }
    203204//       usleep(100);
    204       //yield(); //TODO: find apropriate
     205      receiverThread_->yield(); //TODO: find apropriate
    205206    }
    206207    disconnectClients();
  • code/branches/merge/src/network/ConnectionManager.h

    r1264 r1278  
    4747// enet library for networking support
    4848#include <enet/enet.h>
     49#include <boost/thread/thread.hpp>
    4950
    5051#include "PacketBuffer.h"
     
    112113    ClientInformation *head_;
    113114
    114    
     115    boost::thread *receiverThread_;
    115116//     int getNumberOfClients();
    116117    //functions to map what object every clients uses
  • code/branches/merge/src/orxonox/CMakeLists.txt

    r1264 r1278  
    4343ADD_EXECUTABLE( orxonox ${ORXONOX_SRC_FILES} )
    4444
     45IF(NETWORKTRAFFIC_TESTING_ENABLED)
     46
     47  SET( ORXONOXS_SRC_FILES
     48    GraphicsEngine.cc
     49    objects/Ambient.cc
     50    objects/Camera.cc
     51    objects/CameraHandler.cc
     52    objects/Explosion.cc
     53    objects/Model.cc
     54    objects/NPC.cc
     55    objects/Projectile.cc
     56    objects/Skybox.cc
     57    objects/SpaceShip.cc
     58    objects/WorldEntity.cc
     59  )
     60
     61  ADD_LIBRARY(orxonoxs SHARED ${ORXONOX_SRC_FILES})
     62ENDIF(NETWORKTRAFFIC_TESTING_ENABLED)
     63
    4564TARGET_LINK_LIBRARIES( orxonox
    4665  ${OGRE_LIBRARIES}
  • code/branches/merge/src/orxonox/GraphicsEngine.cc

    r1270 r1278  
    99 *   modify it under the terms of the GNU General Public License
    1010 *   as published by the Free Software Foundation; either version 2
    11  *   of the License, or (at your option) any later version.
    12  *
     11 *   of the License, or (atl your option) any later version.
     12 *lo
    1313 *   This program is distributed in the hope that it will be useful,
    1414 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     
    137137#endif
    138138
    139     // create a logManager
     139/*    // create a logManager
    140140    // note: If there's already a logManager, Ogre will complain by a failed assertation.
    141141    // but that shouldn't happen, since this is the first time to create a logManager..
     
    148148      myLog = logger->createLog("ogre.log", true, false, true);
    149149    else
    150       myLog = logger->createLog(this->ogreLogfile_, true, false, false);
     150          myLog = logger->createLog(this->ogreLogfile_, true, false, false);
    151151    CCOUT(4) << "Ogre Log created" << std::endl;
    152152
    153153    myLog->setLogDetail(Ogre::LL_BOREME);
    154     myLog->addListener(this);
     154    myLog->addListener(this);*/
    155155
    156156    // Root will detect that we've already created a Log
Note: See TracChangeset for help on using the changeset viewer.