Completed the Authtoken Validate Service changes.
This commit is contained in:
		| @@ -625,7 +625,7 @@ CChannel::connectionThread( | ||||
|    // Free SmartCChannel | ||||
|    delete pSmartCChannel; | ||||
|  | ||||
|    DbgTrace(1, "CChannel::connectionThread- End\n", 0); | ||||
|    DbgTrace(0, "CChannel::connectionThread- End\n", 0); | ||||
|  | ||||
|    // Exit | ||||
| 	pthread_exit(NULL); | ||||
|   | ||||
| @@ -38,6 +38,9 @@ extern "C" { | ||||
|  | ||||
| //===[ External data ]===================================================== | ||||
|  | ||||
| extern | ||||
| unsigned long numCChannelObjects; | ||||
|  | ||||
| //===[ External prototypes ]=============================================== | ||||
|  | ||||
| //===[ Manifest constants ]================================================ | ||||
| @@ -116,7 +119,7 @@ IpcClientOpenUnixRemoteEndPoint( | ||||
| // Note:          The service should have been initialized before calling | ||||
| //                this procedure. | ||||
| // | ||||
| // L1 | ||||
| // L2 | ||||
| //=======================================================================-- | ||||
| { | ||||
|    int   retStatus = -1; | ||||
| @@ -241,6 +244,8 @@ IpcClientOpenInetRemoteEndPoint( | ||||
|       pthread_mutex_lock(&clientMutex); | ||||
|  | ||||
|       try { | ||||
|          // tbd - add code to allow us to share endpoints to the same destination that are already opened | ||||
|          //  | ||||
|          // Instantiate a RemoteEndPoint object and keep track of it | ||||
|          // with a smart pointer. | ||||
|          SmartRemoteEndPoint *pSmartRemoteEndPoint = new SmartRemoteEndPoint(new RemoteEndPoint(appMultithreaded, | ||||
| @@ -583,6 +588,11 @@ IpcClientShutdown(void) | ||||
|          delete[] pAppName; | ||||
|          pAppName = unInitialized; | ||||
|       } | ||||
|  | ||||
|       // Wait until all of the channels are gone | ||||
|       while (numCChannelObjects) | ||||
|          sleep(0);   // Only suffer a time-slice | ||||
|       sleep(0); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
| @@ -593,6 +603,26 @@ IpcClientShutdown(void) | ||||
| } | ||||
|  | ||||
|  | ||||
| //++======================================================================= | ||||
| static void __attribute__((destructor)) | ||||
| so_fini() | ||||
| // | ||||
| // Arguments In:  None. | ||||
| // | ||||
| // Arguments Out: None. | ||||
| // | ||||
| // Returns:       Nothing. | ||||
| // | ||||
| // Abstract:      Library un-initialization routine. | ||||
| // | ||||
| // L2 | ||||
| //=======================================================================-- | ||||
| { | ||||
|    DbgTrace(0, "so_fini- Start\n", 0); | ||||
|    IpcClientShutdown(); | ||||
| } | ||||
|  | ||||
|  | ||||
| //========================================================================= | ||||
| //========================================================================= | ||||
|  | ||||
|   | ||||
| @@ -37,7 +37,7 @@ | ||||
|  | ||||
| //===[ Manifest constants ]================================================ | ||||
|  | ||||
| #define REMOTE_ENDPOINT_SIGNATURE  0x54525653 // SVRT | ||||
| #define REMOTE_ENDPOINT_SIGNATURE  0X50454D52   // RMEP | ||||
|  | ||||
| //===[ Type definitions ]================================================== | ||||
|  | ||||
| @@ -75,7 +75,7 @@ RemoteEndPoint::RemoteEndPoint( | ||||
| // | ||||
| //  Notes: | ||||
| // | ||||
| // L1 | ||||
| // L2 | ||||
| //=======================================================================-- | ||||
| { | ||||
|    DbgTrace(1, "RemoteEndPoint::RemoteEndPoint- Start, Obj = %08X\n", this); | ||||
| @@ -349,6 +349,7 @@ RemoteEndPoint::submitReq( | ||||
|  | ||||
|       // Perform the following in a loop to deal with abnormal connection terminations | ||||
|       unsigned long  rpcRetryCount = 0; | ||||
|       bool  okToRetry = true; | ||||
|       while (rpcRetryCount < m_maxRpcRetries) | ||||
|       { | ||||
|          // Get SmartCChannel | ||||
| @@ -372,19 +373,30 @@ RemoteEndPoint::submitReq( | ||||
|             { | ||||
|                // Request submission over the channel succeeded, now | ||||
|                // wait for the completion of the request. | ||||
|                clientReq.waitForCompletion(ppServerData, | ||||
|                                            pServerDataLen); | ||||
|                if (clientReq.waitForCompletion(ppServerData, | ||||
|                                                pServerDataLen) == 0) | ||||
|                { | ||||
|                   // Now proceed based on the completion status | ||||
|                   ClientReq::CompletionStatus compStatus = clientReq.completionStatus(); | ||||
|                   if (compStatus == ClientReq::SuccessCompletionStatus) | ||||
|                   { | ||||
|                      // Success | ||||
|                      retStatus = 0; | ||||
|                   } | ||||
|                   else | ||||
|                   { | ||||
|                      // Received a failure from the server, do not retry. | ||||
|                      okToRetry = false; | ||||
|                   } | ||||
|                } | ||||
|                else | ||||
|                { | ||||
|                   // Error waiting for the completion. | ||||
|                   okToRetry = false; | ||||
|                } | ||||
|  | ||||
|                // Remove the request from the channel | ||||
|                pCChannel->removeReq(reqId); | ||||
|  | ||||
|                // Now proceed based on the completion status | ||||
|                ClientReq::CompletionStatus compStatus = clientReq.completionStatus(); | ||||
|                if (compStatus == ClientReq::SuccessCompletionStatus) | ||||
|                { | ||||
|                   // Success | ||||
|                   retStatus = 0; | ||||
|                } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
| @@ -402,8 +414,9 @@ RemoteEndPoint::submitReq( | ||||
|             DbgTrace(0, "RemoteEndPoint::submitReq- Channel unavailable\n", 0); | ||||
|          } | ||||
|  | ||||
|          // Stop trying if the RPC succeeded | ||||
|          if (retStatus == 0) | ||||
|          // Stop trying if the RPC succeeded or if it is not ok to retry | ||||
|          if (retStatus == 0 | ||||
|              || !okToRetry) | ||||
|             break; | ||||
|  | ||||
|          // Account for this RPC try | ||||
|   | ||||
| @@ -1089,7 +1089,7 @@ IpcServerSetUnAddress( | ||||
| // | ||||
| // Note:          The service needs to be initialized before calling this procedure. | ||||
| // | ||||
| // L1 | ||||
| // L2 | ||||
| //=======================================================================-- | ||||
| { | ||||
|    int   retStatus = -1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user