Menu

#185 MD reply: Infinite timeout wrong handled

1.4.0.0
closed
None
2018-11-07
2017-12-22
No

In a MD request a infinite reply timeout is signaled with replyTimeout=0. But TCNopen v1.3.3.0 a replyTimeout=0 causes always a timeout error.

In trdp_mdHandleRequest() a infinite reply timeout is treated as follow:

/* timeout value */
if ((vos_ntohl(pH->replyTimeout) == 0) && (vos_ntohs(pH->msgType) == TRDP_MSG_MR))
{
    /* Timeout compliance with Table A.18 */
    iterMD->interval.tv_sec     = TDRP_MD_INFINITE_TIME;
    iterMD->interval.tv_usec    = TDRP_MD_INFINITE_USEC_TIME;
    /* Use extreme caution with infinite timeouts! */
    iterMD->timeToGo.tv_sec     = TDRP_MD_INFINITE_TIME;
    iterMD->timeToGo.tv_usec    = TDRP_MD_INFINITE_USEC_TIME;
    /* needs to be set this way to avoid wrap around */
}

Where the constants are define as follow:

/**  Definitions for time out behaviour accd. table A.18 */
#define TDRP_MD_INFINITE_TIME               (0)
#define TDRP_MD_INFINITE_USEC_TIME          (0)

This definitions lead to a timeout error in trdp_mdCheckTimeouts():

/* timeToGo is timeout value! */
if (0 > vos_cmpTime(&iterMD->timeToGo, &now))     /* timeout overflow */
{
    timeOut = trdp_mdTimeOutStateHandler( iterMD, appHandle, &resultCode);
}

Hint:
In TCNopen v1.3.3.2 the function trdp_mdHandleRequest() has handled an infinite timeout as follow:

/* timeout value */
if ((vos_ntohl(pH->replyTimeout) == 0) && (vos_ntohs(pH->msgType) == TRDP_MSG_MR))
{
    /* Timeout compliance with Table A.17 */
    iterMD->interval.tv_sec     = -1;
    iterMD->interval.tv_usec    = 999999;
    /* Use extreme caution with infinite timeouts! */
    iterMD->timeToGo.tv_sec     = -1;
    iterMD->timeToGo.tv_usec    = 999999;
    /* needs to be set this way to avoid wrap around */
}

This handling was no problem for trdp_mdCheckTimeouts().

Discussion

  • Bernd Löhr

    Bernd Löhr - 2018-11-07
    • status: open --> pending
    • assigned_to: Bernd Löhr
     
  • Bernd Löhr

    Bernd Löhr - 2018-11-07
    • Status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB