Changeset 1278 for code/branches/merge/src/network
- Timestamp:
- May 15, 2008, 10:09:02 AM (17 years ago)
- Location:
- code/branches/merge/src/network
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/merge/src/network/CMakeLists.txt
r1264 r1278 55 55 ##### end test for gamestate stuff ##### 56 56 ENDIF(NETWORK_TESTING_ENABLED) 57 # build this if you want dummyserver4 and dummyclient4 58 IF(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 ) 113 ENDIF(NETWORKTRAFFIC_TESTING_ENABLED) 114 57 115 IF(BLABLA) 58 116 SET( CHATCLIENT_SRC_FILES -
code/branches/merge/src/network/ConnectionManager.cc
r1264 r1278 40 40 #include <iostream> 41 41 // boost.thread library for multithreading support 42 #include <boost/thread/thread.hpp>43 42 #include <boost/bind.hpp> 44 43 … … 63 62 namespace network 64 63 { 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) { 70 69 quit=false; 71 70 bindAddress.host = ENET_HOST_ANY; … … 74 73 } 75 74 76 ConnectionManager::ConnectionManager(int port, std::string address, ClientInformation *head) {75 ConnectionManager::ConnectionManager(int port, std::string address, ClientInformation *head) :receiverThread_(0) { 77 76 quit=false; 78 77 enet_address_set_host (& bindAddress, address.c_str()); … … 81 80 } 82 81 83 ConnectionManager::ConnectionManager(int port, const char *address, ClientInformation *head) {82 ConnectionManager::ConnectionManager(int port, const char *address, ClientInformation *head) : receiverThread_(0) { 84 83 quit=false; 85 84 enet_address_set_host (& bindAddress, address); … … 111 110 112 111 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)); 115 115 return; 116 116 } … … 118 118 bool ConnectionManager::quitListener() { 119 119 quit=true; 120 network_threads.join_all(); 120 //network_threads.join_all(); 121 receiverThread_->join(); 121 122 return true; 122 123 } … … 202 203 } 203 204 // usleep(100); 204 //yield(); //TODO: find apropriate205 receiverThread_->yield(); //TODO: find apropriate 205 206 } 206 207 disconnectClients(); -
code/branches/merge/src/network/ConnectionManager.h
r1264 r1278 47 47 // enet library for networking support 48 48 #include <enet/enet.h> 49 #include <boost/thread/thread.hpp> 49 50 50 51 #include "PacketBuffer.h" … … 112 113 ClientInformation *head_; 113 114 114 115 boost::thread *receiverThread_; 115 116 // int getNumberOfClients(); 116 117 //functions to map what object every clients uses
Note: See TracChangeset
for help on using the changeset viewer.