Menu

#223 Windows: Excessive error reporting when polling (rcvmsg)

1.4.1.0
closed
1805 (1) 1806 (1)
2018-11-14
2018-11-13
Bernd Löhr
No

Polling under Windows outputs an error message (EWOULDBLOCK) if no data available.
The error handling in function vos_sock.c:111 recvmsg() should be revised. E.g. WSAIoCtl() will probably never return WSAEWOULDBLOCK.

Discussion

  • Armin-Hagen Weiss

    recvmsg() in Windows vos_sock.c generates an error msg for WSAEWOULDBLOCK.
    Instead of excluding WSAEMSGSIZE in line 137 WSAEWOULDBLOCK should be excluded for generating error messages.

     
  • Armin-Hagen Weiss

    • labels: --> 1805
    • status: open --> closed
    • assigned_to: Armin-Hagen Weiss
     
  • John Varghese

    John Varghese - 2018-11-14

    It still outputs an error message if there is no data received by the function
    it is outputing. "trdp_pdcom.c:972 PDframe size error (8))".
    I feel that if WSARecvMsg is returning SOCKET_ERROR then numBytes will not be a valid value for our case.
    So I suggest returning -1 if there is SOCKET_ERROR.

    Could you please review if my suggestion will work?
    else
    {
    pMessage->dwFlags = flags;
    res = WSARecvMsg(sock, pMessage, &numBytes, NULL, NULL);
    if (0 != res)
    {
    DWORD err = WSAGetLastError();
    if (err != WSAEWOULDBLOCK)
    {
    vos_printLog(VOS_LOG_ERROR, "WSARecvMsg() failed (Err: %d)\n", err);
    }
    return -1;
    }
    }
    return numBytes;
    }

     
  • Armin-Hagen Weiss

    • labels: 1805 --> 1805, 1806
     
    👍
    1
  • Armin-Hagen Weiss

    recvmsg() needs to return SOCKET_ERROR also in case of WSAEWOULDBLOCK even the error message needs to be suppressed.

     
    👍
    1

Log in to post a comment.

MongoDB Logo MongoDB