- Timestamp:
- Jul 30, 2009, 8:40:28 AM (15 years ago)
- Location:
- source/ariba
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/communication/modules/transport/tcp/TCPTransport.cpp
r5151 r5464 203 203 // converting message 204 204 logging_debug( "converting message" ); 205 //std::cout << "XXXXXXXXXXXXreceived data on tcp transport: " << data << std::endl;206 205 Message* msg = new Message(data); 207 206 -
source/ariba/overlay/BaseOverlay.cpp
r5444 r5464 241 241 bc(NULL), overlayInterface(NULL), nodeId(NodeID::UNSPECIFIED), 242 242 spovnetId(SpoVNetID::UNSPECIFIED), state(BaseOverlayStateInvalid), 243 sideport(&SideportListener::DEFAULT), started(false) {243 sideport(&SideportListener::DEFAULT), started(false), counter(0) { 244 244 } 245 245 -
source/ariba/utility/bootstrap/modules/periodicbroadcast/PeriodicBroadcast.h
r5421 r5464 131 131 udp::socket socket_v6; 132 132 udp::endpoint remote_endpoint_; 133 boost::array<char, 1500> recv_buffer_; 133 boost::array<char, 1500> recv_buffer_4; 134 boost::array<char, 1500> recv_buffer_6; 134 135 ServiceList* services; 135 136 boost::mutex* servicesmutex; … … 203 204 void start_receive(){ 204 205 socket_v4.async_receive_from( 205 boost::asio::buffer(recv_buffer_ ), remote_endpoint_,206 boost::bind(&udp_server::handle_receive , this,206 boost::asio::buffer(recv_buffer_4), remote_endpoint_, 207 boost::bind(&udp_server::handle_receive_4, this, 207 208 boost::asio::placeholders::error, 208 209 boost::asio::placeholders::bytes_transferred)); 209 210 210 211 socket_v6.async_receive_from( 211 boost::asio::buffer(recv_buffer_ ), remote_endpoint_,212 boost::bind(&udp_server::handle_receive , this,212 boost::asio::buffer(recv_buffer_6), remote_endpoint_, 213 boost::bind(&udp_server::handle_receive_6, this, 213 214 boost::asio::placeholders::error, 214 215 boost::asio::placeholders::bytes_transferred)); 215 216 } 216 217 217 void handle_receive (const boost::system::error_code& error,218 void handle_receive_4(const boost::system::error_code& error, 218 219 std::size_t bytes_transferred){ 219 220 220 if (!error || error == boost::asio::error::message_size){ 221 222 PeriodicBroadcastMessage msg; 223 Data data( (uint8_t*)recv_buffer_.data(), bytes_transferred*8 ); 224 data_deserialize( msg, data ); 225 226 { // insert new found service 227 boost::mutex::scoped_lock( *servicesmutex ); 228 229 ServiceList::iterator it = services->find( msg.getName() ); 230 if( it != services->end() ){ 231 232 it->second.info1 = msg.getInfo1(); 233 it->second.info2 = msg.getInfo2(); 234 it->second.info3 = msg.getInfo3(); 235 it->second.lastseen = time(NULL); 236 237 } else { 238 Service s( msg.getName(), msg.getInfo1(), msg.getInfo2(), msg.getInfo3(), time(NULL)); 239 services->insert( std::make_pair(msg.getName(), s) ); 240 } 221 if (!error || error == boost::asio::error::message_size) 222 handle_info(recv_buffer_4, bytes_transferred); 223 else 224 logging_warn("failed receiving broadcast data: " << error.message()); 225 226 start_receive(); 227 } 228 229 void handle_receive_6(const boost::system::error_code& error, 230 std::size_t bytes_transferred){ 231 232 if (!error || error == boost::asio::error::message_size) 233 handle_info(recv_buffer_6, bytes_transferred); 234 else 235 logging_warn("failed receiving broadcast data: " << error.message()); 236 237 start_receive(); 238 } 239 240 void handle_info(boost::array<char, 1500>& buffer, std::size_t length){ 241 PeriodicBroadcastMessage msg; 242 243 Data data( (uint8_t*)buffer.data(), length*8 ); 244 data_deserialize( msg, data ); 245 246 { // insert new found service 247 boost::mutex::scoped_lock( *servicesmutex ); 248 249 ServiceList::iterator it = services->find( msg.getName() ); 250 if( it != services->end() ){ 251 252 it->second.info1 = msg.getInfo1(); 253 it->second.info2 = msg.getInfo2(); 254 it->second.info3 = msg.getInfo3(); 255 it->second.lastseen = time(NULL); 256 257 } else { 258 Service s( msg.getName(), msg.getInfo1(), msg.getInfo2(), msg.getInfo3(), time(NULL)); 259 services->insert( std::make_pair(msg.getName(), s) ); 241 260 } 242 243 start_receive();244 } else {245 246 logging_warn("failed receiving message on ipv4 socket" << error);247 248 261 } 249 262 }
Note:
See TracChangeset
for help on using the changeset viewer.