Changeset 62 for osgVisual/src/cluster
- Timestamp:
- Jun 8, 2010, 9:39:17 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/cluster/dataIO_clusterAsioTcpIostream.cpp
r59 r62 15 15 */ 16 16 17 #include " ..\..\include\cluster\dataIO_clusterAsioTcpIostream.h"17 #include "dataIO_clusterAsioTcpIostream.h" 18 18 19 19 using namespace osgVisual; 20 20 21 dataIO_clusterAsioTcpIostream::dataIO_clusterAsioTcpIostream() 21 using boost::asio::ip::tcp; 22 23 dataIO_clusterAsioTcpIostream::dataIO_clusterAsioTcpIostream() 22 24 { 23 OSG_NOTIFY( osg::ALWAYS ) << "clusterAsioTcpIostream constructed" << std::endl; 25 OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream constructed" << std::endl; 26 27 port = 5678; 28 initialized = false; 24 29 } 25 30 26 dataIO_clusterAsioTcpIostream::~dataIO_clusterAsioTcpIostream( void)31 dataIO_clusterAsioTcpIostream::~dataIO_clusterAsioTcpIostream() 27 32 { 28 OSG_NOTIFY( osg::ALWAYS ) << "clusterAsioTcpIostream destructed" << std::endl;33 OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream destructed" << std::endl; 29 34 } 30 35 31 36 void dataIO_clusterAsioTcpIostream::init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ) 32 37 { 33 OSG_NOTIFY( osg::ALWAYS ) << "clusterAsioTcpIostream init()" << std::endl; 38 OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream initialized" << std::endl; 39 40 clusterMode = clusterMode_; 41 42 if(clusterMode == osgVisual::dataIO_cluster::MASTER) 43 { 44 45 46 tcp::endpoint endpoint(tcp::v4(), port); 47 tcp::acceptor acceptor(io_service, endpoint); 48 49 tcp::iostream stream; 50 51 acceptor.accept(*stream.rdbuf()); 52 tcp::no_delay option(true); 53 boost::system::error_code ec; 54 stream.rdbuf()->set_option(option, ec); 55 if (ec) 56 { 57 OSG_NOTIFY(osg::WARN) << "Error: Unable to set TCP_NODELAY option" << ec << std::endl; 58 // An error occurred. 59 } 60 } 61 62 if(clusterMode == osgVisual::dataIO_cluster::SLAVE) 63 { 64 65 } 66 67 initialized = true; 34 68 } 35 69 36 70 void dataIO_clusterAsioTcpIostream::shutdown() 37 71 { 38 OSG_NOTIFY( osg::ALWAYS ) << "clusterAsioTcpIostream shutdown()" << std::endl; 72 OSG_NOTIFY(osg::ALWAYS) << "dataIO_clusterAsioTcpIostream shut down" << std::endl; 73 74 if(initialized) 75 { 76 77 } 39 78 } 40 79 41 80 bool dataIO_clusterAsioTcpIostream::sendTO_OBJvaluesToSlaves() 42 81 { 43 OSG_NOTIFY( osg::INFO ) << "clusterAsioTcpIostream sendTO_OBJvaluesToSlaves()" << std::endl; 82 OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::sendTO_OBJvaluesToSlaves()" << std::endl; 83 44 84 return true; 45 85 } … … 47 87 bool dataIO_clusterAsioTcpIostream::readTO_OBJvaluesFromMaster() 48 88 { 49 OSG_NOTIFY( osg::INFO ) << "clusterAsioTcpIostreamreadTO_OBJvaluesFromMaster()" << std::endl;89 OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::readTO_OBJvaluesFromMaster()" << std::endl; 50 90 51 91 return true; … … 54 94 void dataIO_clusterAsioTcpIostream::reportAsReadyToSwap() 55 95 { 56 OSG_NOTIFY( osg::INFO ) << "clusterAsioTcpIostreamreportAsReadyToSwap()" << std::endl;96 OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::reportAsReadyToSwap()" << std::endl; 57 97 } 58 98 59 99 bool dataIO_clusterAsioTcpIostream::waitForSwap() 60 100 { 61 OSG_NOTIFY( osg::INFO ) << "clusterAsioTcpIostream waitForSwap()" << std::endl; 101 OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::waitForAllReadyToSwap()" << std::endl; 102 62 103 return true; 63 104 } … … 65 106 bool dataIO_clusterAsioTcpIostream::waitForAllReadyToSwap() 66 107 { 67 OSG_NOTIFY( osg::INFO ) << "clusterAsioTcpIostream waitForAllReadyToSwap()" << std::endl; 108 OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::waitForAllReadyToSwap()" << std::endl; 109 68 110 return true; 69 111 } … … 71 113 bool dataIO_clusterAsioTcpIostream::sendSwapCommand() 72 114 { 73 OSG_NOTIFY( osg::INFO ) << "clusterAsioTcpIostream sendSwapCommand()" << std::endl; 115 OSG_NOTIFY(osg::INFO) << "dataIO_clusterAsioTcpIostream::sendSwapCommand()" << std::endl; 116 74 117 return true; 75 118 }
Note: See TracChangeset
for help on using the changeset viewer.