scpi: Don't process received data of zero length
When nothing was received in a read attempt, we need not adjust the buffered data's read position nor the glib string object's size. Skip any processing for empty input, just keep checking for timeouts.
This commit is contained in:
parent
ad21865fa7
commit
900846816f
|
@ -453,9 +453,9 @@ SR_PRIV int sr_scpi_get_data(struct sr_scpi_dev_inst *scpi,
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
} else if (len > 0) {
|
} else if (len > 0) {
|
||||||
laststart = g_get_monotonic_time();
|
laststart = g_get_monotonic_time();
|
||||||
}
|
|
||||||
offset += len;
|
offset += len;
|
||||||
g_string_set_size(response, offset);
|
g_string_set_size(response, offset);
|
||||||
|
}
|
||||||
/* Quit reading after a period of time without receive data. */
|
/* Quit reading after a period of time without receive data. */
|
||||||
elapsed_ms = (g_get_monotonic_time() - laststart) / 1000;
|
elapsed_ms = (g_get_monotonic_time() - laststart) / 1000;
|
||||||
if (elapsed_ms >= scpi->read_timeout_ms) {
|
if (elapsed_ms >= scpi->read_timeout_ms) {
|
||||||
|
|
Loading…
Reference in New Issue