Changeset 5289 for source/ariba/utility/transport
- Timestamp:
- Jul 24, 2009, 4:32:18 PM (15 years ago)
- Location:
- source/ariba/utility/transport/rfcomm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/transport/rfcomm/rfcomm.cpp
r5286 r5289 49 49 std::deque<link_data> send_buffer; 50 50 }; 51 52 void rfcomm::remove_info(link_info* info) { 53 for (vector<link_info*>::iterator i = links.begin(); i!=links.end();i++) 54 if (*i==info) { 55 delete info; 56 links.erase(i); 57 } 58 } 59 51 60 52 61 inline bluetooth::rfcomm::endpoint convert( const rfcomm_endpoint& endpoint ) { … … 222 231 223 232 void rfcomm::start_read(link_info* info) { 224 cout << "Waiting for messages..." << endl;225 226 233 // start read 227 234 boost::asio::async_read(info->socket, … … 271 278 272 279 // ignore errors and wait for all data to be received 273 if (error || bytes != info->size) return; 280 if (error || bytes != info->size) { 281 if (error) remove_info(info); 282 return; 283 } 274 284 275 285 cout << "received message of size " << info->size << endl; … … 321 331 // ignore errors and wait for all data to be sent 322 332 if (error || bytes != (size+4) ) { 323 if (error) cout << "Message sent error" << endl; 333 if (error) { 334 cout << "Message sent error" << endl; 335 remove_info(info); 336 } 324 337 return; 325 338 } -
source/ariba/utility/transport/rfcomm/rfcomm.hpp
r5284 r5289 59 59 void handle_write_data(const error_code& error, size_t bytes, 60 60 link_info* info, size_t size, uint8_t* buffer ); 61 62 void remove_info(link_info* info); 61 63 }; 62 64
Note:
See TracChangeset
for help on using the changeset viewer.