forked from Archive/PX4-Autopilot
protocol_splitter: return 0 when no data to read instead of -1
This avoids mavlink adding another usleep() due to read error
This commit is contained in:
parent
375b014444
commit
868f9cebb0
|
@ -366,7 +366,7 @@ pollevent_t DevCommon::poll_state(struct file *filp)
|
|||
int DevCommon::try_to_copy_data(char *buffer, size_t buflen, MessageType message_type)
|
||||
{
|
||||
if (buflen == 0) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (message_type) {
|
||||
|
@ -398,7 +398,7 @@ int DevCommon::try_to_copy_data(char *buffer, size_t buflen, MessageType message
|
|||
return len_to_copy;
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case MessageType::Rtps:
|
||||
|
@ -429,14 +429,14 @@ int DevCommon::try_to_copy_data(char *buffer, size_t buflen, MessageType message
|
|||
return len_to_copy;
|
||||
|
||||
} else {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue