Changeset 183 for osgVisual/trunk/src/cluster
- Timestamp:
- Jan 7, 2011, 5:41:45 PM (14 years ago)
- Location:
- osgVisual/trunk/src/cluster
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/src/cluster/dataIO_clusterDummy.cpp
r59 r183 29 29 } 30 30 31 void dataIO_clusterDummy::init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_)31 bool dataIO_clusterDummy::init(xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_) 32 32 { 33 33 sendContainer = sendContainer_; 34 34 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy init();" << std::endl; 35 return true; 36 } 37 38 bool dataIO_clusterDummy::processXMLConfiguration(xmlNode* clusterConfig_) 39 { 40 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy processXMLConfiguration();" << std::endl; 41 return true; 35 42 } 36 43 … … 40 47 } 41 48 42 bool dataIO_clusterDummy::sendTO_OBJvaluesToSlaves( )49 bool dataIO_clusterDummy::sendTO_OBJvaluesToSlaves(osg::Matrixd viewMatrix_) 43 50 { 44 51 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy sendTO_OBJvaluesToSlaves()" << std::endl; -
osgVisual/trunk/src/cluster/dataIO_clusterENet.cpp
r88 r183 35 35 36 36 37 void dataIO_clusterENet::init( osg::ArgumentParser& arguments_, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ) 38 { 37 bool dataIO_clusterENet::init(xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_) 38 { 39 if (!configurationNode || !processXMLConfiguration(configurationNode)) 40 return false; 41 39 42 OSG_NOTIFY( osg::ALWAYS ) << "clusterENet init();" << std::endl; 40 43 … … 56 59 writeOptionString = "Ascii"; 57 60 } 58 if (compressionEnabled _)61 if (compressionEnabled) 59 62 writeOptionString+=" Compressor=zlib"; 60 63 readOptions = new osgDB::Options( readOptionString.c_str() ); … … 77 80 if(clusterMode == SLAVE) 78 81 { 79 // Get the server IP80 if(!arguments_.read("--server",serverToConnect, port))81 {82 // try server discovery83 //discoverServer(serverToConnect,port);84 /* todo : implement a udp server discovery based on ASIO */85 }86 87 82 // Init ENet 88 83 enet_impl->init(dataIO_clusterENet_implementation::CLIENT, port); … … 105 100 initialized = false; 106 101 std::cout << "Finally failed to establish connection to server " << serverToConnect << std::endl; 107 exit(-1);102 return false; 108 103 } 109 104 } // IF SLAVE END 105 106 return true; 107 } 108 109 bool dataIO_clusterENet::processXMLConfiguration(xmlNode* clusterConfig_) 110 { 111 // Extract cluster role 112 xmlAttr *attr = clusterConfig_->properties; 113 while ( attr ) 114 { 115 std::string attr_name=reinterpret_cast<const char*>(attr->name); 116 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 117 if( attr_name == "implementation" ) 118 { 119 if(attr_value != "enet") 120 { 121 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: Cluster configuration does not match the 'enet' implementation, falling back to clusterDummy" << std::endl; 122 return false; 123 } 124 } 125 if( attr_name == "hardsync" ) 126 { 127 if(attr_value == "yes") 128 hardSync = true; 129 else 130 hardSync = false; 131 } 132 if( attr_name == "master_ip" ) 133 { 134 serverToConnect = attr_value; 135 } 136 if( attr_name == "port" ) 137 { 138 std::istringstream i(attr_value); 139 if (!(i >> port)) 140 { 141 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: Cluster configuration : Invalid port number '" << attr_value << "', falling back to clusterDummy" << std::endl; 142 return false; 143 } 144 } 145 if( attr_name == "use_zlib_compressor" ) 146 { 147 if(attr_value == "yes") 148 compressionEnabled = true; 149 else 150 compressionEnabled = false; 151 } 152 attr = attr->next; 153 } // WHILE attrib END 154 155 return true; 110 156 } 111 157
Note: See TracChangeset
for help on using the changeset viewer.