don't return error when write fails, just wait and try again - kudos to Eric for pointing out this flaw

This commit is contained in:
matthias.ringwald 2010-08-16 17:26:46 +00:00
parent 622d0de9a0
commit b90ae666ea
2 changed files with 4 additions and 2 deletions

View File

@ -197,7 +197,8 @@ static int h4_send_packet(uint8_t packet_type, uint8_t * packet, int size){
while (size > 0) {
int bytes_written = write(hci_transport_h4->ds->fd, data, size);
if (bytes_written < 0) {
return bytes_written;
usleep(5000);
continue;
}
data += bytes_written;
size -= bytes_written;

View File

@ -179,7 +179,8 @@ static int h5_send_packet(uint8_t packet_type, uint8_t *packet, int size){
while (size > 0) {
int bytes_written = write(hci_transport_h5->ds->fd, data, size);
if (bytes_written < 0) {
return bytes_written;
usleep(5000);
continue;
}
data += bytes_written;
size -= bytes_written;