Skip to content

pasynOctetSyncIO->read overwrites pasynUser->timeout #220

@ericonr

Description

@ericonr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions