Changeset 67 for osgVisual/src
- Timestamp:
- Jul 11, 2010, 1:31:29 PM (14 years ago)
- Location:
- osgVisual/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/cluster/dataIO_clusterENet.cpp
r66 r67 22 22 { 23 23 OSG_NOTIFY( osg::ALWAYS ) << "clusterENet constructed" << std::endl; 24 serverToConnect = "unknown"; 24 25 } 26 25 27 26 28 dataIO_clusterENet::~dataIO_clusterENet(void) … … 29 31 } 30 32 33 31 34 void dataIO_clusterENet::init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ) 32 35 { 33 36 OSG_NOTIFY( osg::ALWAYS ) << "clusterENet init();" << std::endl; 34 37 38 // Configure the clustermode 39 clusterMode = clusterMode_; 40 41 // store sendContainer 35 42 sendContainer = sendContainer_; 36 43 37 44 // create ENet implementation object. 38 45 enet_impl = new osgVisual::dataIO_clusterENet_implementation(); 46 47 // initialize ENet implementation 48 if(clusterMode == MASTER) 49 { 50 enet_impl->init(dataIO_clusterENet_implementation::SERVER, port); 51 52 initialized = true; 53 } 54 if(clusterMode == SLAVE) 55 { 56 // Get the server IP 57 if(!arguments_.read("--server",serverToConnect, port)) 58 { 59 // try server discovery 60 //discoverServer(serverToConnect,port); 61 /* todo : implement a udp server discovery based on ASIO */ 62 } 63 64 // Init ENet 65 enet_impl->init(dataIO_clusterENet_implementation::CLIENT, port); 66 67 // Connect to server with 5 retries: 68 bool connected = false; 69 for(int i=0; i<5; i++) 70 { 71 std::cout << "Try to connect to server " << serverToConnect << std::endl; 72 if( enet_impl->connectTo( serverToConnect.c_str(), 5000 ) ) 73 { 74 // Connect successful. 75 initialized = true; 76 connected = true; 77 break; 78 } 79 } // For END 80 if(!connected) 81 { 82 initialized = false; 83 std::cout << "Failed to establish connection to server " << serverToConnect << std::endl; 84 } 85 } // IF SLAVE END 39 86 } 87 40 88 41 89 void dataIO_clusterENet::shutdown() … … 43 91 OSG_NOTIFY( osg::ALWAYS ) << "clusterENet shutdown();" << std::endl; 44 92 } 93 45 94 46 95 bool dataIO_clusterENet::sendTO_OBJvaluesToSlaves() … … 51 100 } 52 101 102 53 103 bool dataIO_clusterENet::readTO_OBJvaluesFromMaster() 54 104 { … … 57 107 return true; 58 108 } 109 59 110 60 111 void dataIO_clusterENet::reportAsReadyToSwap() … … 70 121 } 71 122 123 72 124 bool dataIO_clusterENet::waitForAllReadyToSwap() 73 125 { … … 77 129 } 78 130 131 79 132 bool dataIO_clusterENet::sendSwapCommand() 80 133 { -
osgVisual/src/cluster/dataIO_clusterENet_implementation.cpp
r66 r67 9 9 std::cout << "Instantiated server class# "<< activeENetInstances << std::endl; 10 10 serverInitialized = false; 11 host = NULL; 11 12 // Start ENet 12 13 if (activeENetInstances++ == 0) … … 25 26 dataIO_clusterENet_implementation::~dataIO_clusterENet_implementation() 26 27 { 27 // Delete Host Object 28 enet_host_destroy(host); 28 // Delete Host Object if instantiated 29 if(host) 30 enet_host_destroy(host); 29 31 30 32 // Stop ENet if it is the last element. -
osgVisual/src/core/visual_core.cpp
r58 r67 56 56 OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_core..." << std::endl; 57 57 58 // Process commandline arguments for configuration parameter59 processCommandlineArguments();60 61 58 // Add manipulators for user interaction 62 59 addManipulators(); … … 250 247 } 251 248 252 void visual_core::processCommandlineArguments() 253 { 254 std::cout << "Processing general commandline arguments..." << std::endl; 255 249 250 bool visual_core::checkCommandlineArgumentsForFinalErrors() 251 { 256 252 // Setup Application Usage 257 253 arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); … … 275 271 viewer->setDone(true); 276 272 } 277 } 278 279 bool visual_core::checkCommandlineArgumentsForFinalErrors() 280 { 273 281 274 // any option left unread are converted into errors to write out later. 282 275 arguments.reportRemainingOptionsAsUnrecognized(); -
osgVisual/src/dataIO/visual_dataIO.cpp
r65 r67 56 56 OSG_NOTIFY( osg::ALWAYS ) << "Configure osgVisual as SLAVE" << std::endl; 57 57 clusterMode = osgVisual::dataIO_cluster::SLAVE; 58 // Slave only recieves container, therefor set this Pointer null. 59 slotContainer = NULL; 58 slotContainer = NULL; // Slave only recieves container, therefor set this Pointer null. 60 59 } 61 60 else
Note: See TracChangeset
for help on using the changeset viewer.