nthallen / monarch

Monarch Data Acquisition System
0 stars 1 forks source link

Review timeout handling in protocol_input() #157

Closed nthallen closed 2 years ago

nthallen commented 2 years ago

A change to interface.cc to work around a problem with a Silicon Labs CP201X device (read blocks) could cause unanticipated behavior in older drivers if they did not use protocol_timeout() exclusively to handle timeout conditions.

In some older drivers (possibly under QNX), I called fillbuf() on timeout just to make really sure I was not missing any data before giving up. I could then check TO.Expired() to see if this was also a timeout condition. Unfortunately with some poorly-designed OS drivers, a read call can block if there is no data, even when the device is marked non-blocking.

I need to look through all existing monarch code implementing protocol_input() and/or app_input() to make sure that the code implements protocol_timeout() if timeouts are supported at all.

nthallen commented 2 years ago

Evaluation of current usage indicates this change is safe.