Bug: 35935

Impact:

Product:
GBS-VW

Versions:
7.1

Platform:
VW, Windows

Fixed In:
7.1.1

"Failed to arm read event" error on Windows

On Windows, it is possible for a non-blocking RPC session to
experience a "Failed to arm read event" error. This can occur only
when using the default "waiting" method of determining when a server
response or asynchronous event is available.

Workaround:

There are two options to work around this problem.

1. Set both of the GbsConfiguration options #pollforRpcResponse and
   #pollForAsynchronousEvents to true. A session logged in after
   these are set to true will not encounter this error.

2. Modify GBS code by adding one new method and modifying another.

  Add the method GbxCWinSupportInterface>support>getLastSocketError
  -------------------
  getLastSocketError
        "| anInterface |
        anInterface := self new.
        anInterface getLastSocketError"
  
       <C: int WSAGetLastError(void)>
       ^self gbxGciError: _errorCode
  -------------------

  Modify the method GbxWinSocketAccessor>>armReadEvent to read:
  -------------------
  armReadEvent
       "Call WSAAsyncSelect to arm read events for the socket.
       This will result in an immediate event if there are any bytes currently waiting."
  
       "16r0400=WSA_SOCKEVENT"
  
       "16r01=FD_READ"
  
       (winInterface
            asyncSelect: self socketHandle
            with: windowHandle
            with: 16r0400
            with: 16r01) = 0
            ifFalse:
                 [| firstErrorCode |
                 firstErrorCode := winInterface getLastSocketError.
                 "Refresh windowHandle and try one more time."
                 windowHandle := winInterface findWindow: 'OWSTS' asCString with: 0.
                 (winInterface
                      asyncSelect: self socketHandle
                      with: windowHandle
                      with: 16r0400
                      with: 16r01) = 0
                      ifFalse:
                           [| secondErrorCode |
                           secondErrorCode := winInterface getLastSocketError.
                           self gbsMessenger
                                error: 'Failed to arm read event; codes %1 and %2'
                                with: firstErrorCode printString
                                with: secondErrorCode printString]]
  --------------------