[ 
https://issues.apache.org/jira/browse/GEODE-10096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Blake Bender updated GEODE-10096:
---------------------------------
    Description: 
In the method TcrConnection::initTcrConnection, the following block of code 
appears:
{code:java}
    switch (acceptanceCode[0]) {
      case REPLY_OK:
      case SUCCESSFUL_SERVER_TO_CLIENT:
        LOGFINER("Handshake reply: %u,%u,%u", acceptanceCode[0],
                 serverQueueStatus[0], recvMsgLen2);
        if (isClientNotification) readHandshakeInstantiatorMsg(connectTimeout);
        break;
      case REPLY_AUTHENTICATION_FAILED: {
        AuthenticationFailedException ex(
            reinterpret_cast<char*>(recvMessage.data()));
        m_conn.reset();
        throwException(ex);
      }
      case REPLY_AUTHENTICATION_REQUIRED: {
        AuthenticationRequiredException ex(
            reinterpret_cast<char*>(recvMessage.data()));
        m_conn.reset();
        throwException(ex);
      }
      case REPLY_DUPLICATE_DURABLE_CLIENT: {
        DuplicateDurableClientException ex(
            reinterpret_cast<char*>(recvMessage.data()));
        m_conn.reset();
        throwException(ex);
      }
      case REPLY_REFUSED:
      case REPLY_INVALID:
      case UNSUCCESSFUL_SERVER_TO_CLIENT: {
        LOGERROR("Handshake rejected by server[%s]: %s",
                 m_endpointObj->name().c_str(),
                 reinterpret_cast<char*>(recvMessage.data()));
        auto message = std::string("TcrConnection::TcrConnection: ") +
                       "Handshake rejected by server: " +
                       reinterpret_cast<char*>(recvMessage.data());
        CacheServerException ex(message);
        m_conn.reset();
        throw ex;
      }
{code}
These response codes are unique to the server handshake, and not used anywhere 
else in the code. We need to remove the #definess for them and put them in a 
proper enum class.

  was:
In the method `TcrConnection::initTcrConnection`, the following block of code 
appears:

```
    switch (acceptanceCode[0]) {
      case REPLY_OK:
      case SUCCESSFUL_SERVER_TO_CLIENT:
        LOGFINER("Handshake reply: %u,%u,%u", acceptanceCode[0],
                 serverQueueStatus[0], recvMsgLen2);
        if (isClientNotification) readHandshakeInstantiatorMsg(connectTimeout);
        break;
      case REPLY_AUTHENTICATION_FAILED: {
        AuthenticationFailedException ex(
            reinterpret_cast<char*>(recvMessage.data()));
        m_conn.reset();
        throwException(ex);
      }
      case REPLY_AUTHENTICATION_REQUIRED: {
        AuthenticationRequiredException ex(
            reinterpret_cast<char*>(recvMessage.data()));
        m_conn.reset();
        throwException(ex);
      }
      case REPLY_DUPLICATE_DURABLE_CLIENT: {
        DuplicateDurableClientException ex(
            reinterpret_cast<char*>(recvMessage.data()));
        m_conn.reset();
        throwException(ex);
      }
      case REPLY_REFUSED:
      case REPLY_INVALID:
      case UNSUCCESSFUL_SERVER_TO_CLIENT: {
        LOGERROR("Handshake rejected by server[%s]: %s",
                 m_endpointObj->name().c_str(),
                 reinterpret_cast<char*>(recvMessage.data()));
        auto message = std::string("TcrConnection::TcrConnection: ") +
                       "Handshake rejected by server: " +
                       reinterpret_cast<char*>(recvMessage.data());
        CacheServerException ex(message);
        m_conn.reset();
        throw ex;
      }
```
These response codes are unique to the server handshake, and not used anywhere 
else in the code.  We need to remove the `#define`s for them and put them in a 
proper `enum class`.


> Handshake "acceptance codes" should be an enum class
> ----------------------------------------------------
>
>                 Key: GEODE-10096
>                 URL: https://issues.apache.org/jira/browse/GEODE-10096
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Blake Bender
>            Priority: Major
>
> In the method TcrConnection::initTcrConnection, the following block of code 
> appears:
> {code:java}
>     switch (acceptanceCode[0]) {
>       case REPLY_OK:
>       case SUCCESSFUL_SERVER_TO_CLIENT:
>         LOGFINER("Handshake reply: %u,%u,%u", acceptanceCode[0],
>                  serverQueueStatus[0], recvMsgLen2);
>         if (isClientNotification) 
> readHandshakeInstantiatorMsg(connectTimeout);
>         break;
>       case REPLY_AUTHENTICATION_FAILED: {
>         AuthenticationFailedException ex(
>             reinterpret_cast<char*>(recvMessage.data()));
>         m_conn.reset();
>         throwException(ex);
>       }
>       case REPLY_AUTHENTICATION_REQUIRED: {
>         AuthenticationRequiredException ex(
>             reinterpret_cast<char*>(recvMessage.data()));
>         m_conn.reset();
>         throwException(ex);
>       }
>       case REPLY_DUPLICATE_DURABLE_CLIENT: {
>         DuplicateDurableClientException ex(
>             reinterpret_cast<char*>(recvMessage.data()));
>         m_conn.reset();
>         throwException(ex);
>       }
>       case REPLY_REFUSED:
>       case REPLY_INVALID:
>       case UNSUCCESSFUL_SERVER_TO_CLIENT: {
>         LOGERROR("Handshake rejected by server[%s]: %s",
>                  m_endpointObj->name().c_str(),
>                  reinterpret_cast<char*>(recvMessage.data()));
>         auto message = std::string("TcrConnection::TcrConnection: ") +
>                        "Handshake rejected by server: " +
>                        reinterpret_cast<char*>(recvMessage.data());
>         CacheServerException ex(message);
>         m_conn.reset();
>         throw ex;
>       }
> {code}
> These response codes are unique to the server handshake, and not used 
> anywhere else in the code. We need to remove the #definess for them and put 
> them in a proper enum class.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to