-
Notifications
You must be signed in to change notification settings - Fork 82
Description
asyn/asyn/interfaces/asynOctetSyncIO.c
Lines 205 to 213 in e417caf
| static asynStatus readIt(asynUser *pasynUser, | |
| char *buffer, size_t buffer_len, | |
| double timeout, | |
| size_t *nbytesTransfered,int *eomReason) | |
| { | |
| asynStatus status, unlockStatus; | |
| ioPvt *pioPvt = (ioPvt *)pasynUser->userPvt; | |
| pasynUser->timeout = timeout; |
The read function takes a separate timeout parameter instead of using the timeout value already included in the asynUser struct, but then it stuffs that timeout into the struct in order to pass it forward.
This leads to a confusing situation where pasynUser->timeout is overwritten, without any documentation indicating that can happen, and, IMO, with the function signature taking a separate timeout parameter implying that pasynUser->timeout doesn't matter here, making me expect it to not be touched at all.
There are two possible solutions: documenting this, or changing the behavior slightly by adding double oldTimeout = pasynUser-> timeout; pasynUser->timeout = timeout; ...; pasynUser->timeout = oldTimeout;. Do you think there's anyone relying on this behavior? If not, I think changing it would be the best path forward.