Changeset 5410 for source/ariba/utility/transport/rfcomm
- Timestamp:
- Jul 29, 2009, 11:06:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/transport/rfcomm/rfcomm.cpp
r5406 r5410 104 104 void rfcomm::stop() { 105 105 logging_info( "Stopping asio rfcomm" ); 106 107 106 } 108 107 … … 175 174 for (size_t i = 0; i < links.size(); i++) 176 175 if (links[i]->remote.mac() == endpoint.mac()) { 177 178 176 // close socket 179 links[i]->socket.cancel(); 180 links[i]->socket.close(); 181 links[i]->up = false; 177 shutdown(links[i]); 182 178 break; 183 179 } … … 208 204 logging_error( "Error waiting for new connections: " << error 209 205 << ", trying to recover (attempt " << accept_retries << ")"); 210 delete info;211 206 212 207 // restart accepting … … 214 209 accept_retries++; 215 210 start_accept(); 216 } 211 } else 212 delete info; 213 217 214 return; 218 215 } … … 343 340 344 341 // wait for all data to be received 345 if (bytes != info->size) return; 342 if (bytes != info->size) 343 return; 346 344 347 345 logging_debug( "Received message of size " << info->size ); … … 363 361 if (info->sending || !info->up || info->send_buffer.size()==0) return; 364 362 365 cout << "Sending messages..." << endl;363 logging_debug("Sending messages ..."); 366 364 367 365 // safely remove data from deque … … 391 389 link_info* info, size_t size, uint8_t* buffer ) { 392 390 393 // ignore errors and wait for all data to be sent394 if (error || bytes != (size+4)) {395 if (error) {396 logging_error( "Message sent error");397 398 // close socket399 info->socket.close(); 400 info->up = false;401 }402 return; 403 } 391 // handle error 392 if (error) { 393 logging_error( "Message sent error" ); 394 shutdown(info); 395 return; 396 } 397 398 // wait for all data to be sent 399 if (bytes != (size+4) ) 400 return; 401 404 402 logging_debug( "Message sent" ); 405 403
Note:
See TracChangeset
for help on using the changeset viewer.