Browse Source

[1542] Constants when receiving rcodes

Michal 'vorner' Vaner 13 years ago
parent
commit
c911317eb2
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/lib/server_common/socket_request.cc

+ 6 - 2
src/lib/server_common/socket_request.cc

@@ -64,6 +64,10 @@ const std::string& RELEASE_SOCKET_COMMAND() {
     return (str);
 }
 
+// RCode constants for the get_token command
+const size_t SOCKET_ERROR_CODE = 2;
+const size_t SHARE_ERROR_CODE = 3;
+
 // A helper converter from numeric protocol ID to the corresponding string.
 // used both for generating a message for the boss process and for logging.
 inline const char*
@@ -134,10 +138,10 @@ readRequestSocketAnswer(isc::data::ConstElementPtr recv_msg,
     isc::data::ConstElementPtr answer = isc::config::parseAnswer(rcode,
                                                                  recv_msg);
     // Translate known rcodes to the corresponding exceptions
-    if (rcode == 2) {
+    if (rcode == SOCKET_ERROR_CODE) {
         isc_throw(SocketRequestor::SocketAllocateError, answer->str());
     }
-    if (rcode == 3) {
+    if (rcode == SHARE_ERROR_CODE) {
         isc_throw(SocketRequestor::ShareError, answer->str());
     }
     // The unknown exceptions