diff --git a/src/rm_transport.c b/src/rm_transport.c
index a0c627409eaaf7a1543c50a852cfcf5d32fe45fb..aba3c93d2e66f5273fd9d37646b681abccd18df2 100644 (file)
--- a/src/rm_transport.c
+++ b/src/rm_transport.c
* instance name. NULL is returned if no transports in \r
* the list match the remote instance name.\r
*/\r
-Rm_Transport *rmTransportFindRemoteName(Rm_Transport *transports, char *remoteName)\r
+Rm_Transport *rmTransportFindRemoteName(Rm_Transport *transports, const char *remoteName)\r
{\r
while (transports) {\r
if (strncmp(transports->remoteInstName, remoteName, RM_NAME_MAX_CHARS) == 0) {\r
@@ -216,45 +216,52 @@ Rm_TransportHandle Rm_transportRegister (const Rm_TransportCfg *transportCfg, in
goto errorExit;\r
}\r
\r
- /* No one can connect to a shared server\r
- * RM Servers cannot connect to other Servers. \r
- * RM Client Delegates cannot connect to other Client Delegates.\r
- * RM Clients cannot connect to other Clients */\r
- if ((transportCfg->remoteInstType == Rm_instType_SHARED_SERVER) ||\r
- ((rmInst->instType == Rm_instType_SERVER) &&\r
- (transportCfg->remoteInstType == Rm_instType_SERVER)) ||\r
- ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
- (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) ||\r
- ((rmInst->instType == Rm_instType_CLIENT) &&\r
- (transportCfg->remoteInstType == Rm_instType_CLIENT))) {\r
- *result = RM_ERROR_INVALID_REMOTE_INST_TYPE;\r
- goto errorExit;\r
+ if (transport = rmTransportFindRemoteName(rmInst->transports, transportCfg->remoteInstName)) {\r
+ /* Reconfigure existing transport's appTransportHandle. Used in cases where instances\r
+ * running on same core connected by function call. */\r
+ transport->appTransportHandle = transportCfg->appTransportHandle;\r
}\r
+ else {\r
+ /* No one can connect to a shared server\r
+ * RM Servers cannot connect to other Servers. \r
+ * RM Client Delegates cannot connect to other Client Delegates.\r
+ * RM Clients cannot connect to other Clients */\r
+ if ((transportCfg->remoteInstType == Rm_instType_SHARED_SERVER) ||\r
+ ((rmInst->instType == Rm_instType_SERVER) &&\r
+ (transportCfg->remoteInstType == Rm_instType_SERVER)) ||\r
+ ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
+ (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) ||\r
+ ((rmInst->instType == Rm_instType_CLIENT) &&\r
+ (transportCfg->remoteInstType == Rm_instType_CLIENT))) {\r
+ *result = RM_ERROR_INVALID_REMOTE_INST_TYPE;\r
+ goto errorExit;\r
+ }\r
\r
- /* Verify Clients are not registering with more than one Client Delegate or Server. And\r
- * that Client Delegate is not registering with more than one Server. */\r
- if (rmInst->registeredWithDelegateOrServer &&\r
- (((rmInst->instType == Rm_instType_CLIENT) &&\r
- (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) || \r
- ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
- (transportCfg->remoteInstType == Rm_instType_SERVER)))) {\r
- *result = RM_ERROR_ALREADY_REGD_SERVER_OR_CD;\r
- goto errorExit;\r
- } \r
- \r
- if (!transportCfg->transportCallouts.rmAllocPkt) {\r
- *result = RM_ERROR_TRANSPORT_ALLOC_PKT_NOT_REGD;\r
- goto errorExit;\r
- }\r
- else if (!transportCfg->transportCallouts.rmSendPkt) {\r
- *result = RM_ERROR_TRANSPORT_SEND_NOT_REGD;\r
- goto errorExit;\r
- }\r
+ /* Verify Clients are not registering with more than one Client Delegate or Server. And\r
+ * that Client Delegate is not registering with more than one Server. */\r
+ if (rmInst->registeredWithDelegateOrServer &&\r
+ (((rmInst->instType == Rm_instType_CLIENT) &&\r
+ (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) || \r
+ ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
+ (transportCfg->remoteInstType == Rm_instType_SERVER)))) {\r
+ *result = RM_ERROR_ALREADY_REGD_SERVER_OR_CD;\r
+ goto errorExit;\r
+ } \r
+ \r
+ if (!transportCfg->transportCallouts.rmAllocPkt) {\r
+ *result = RM_ERROR_TRANSPORT_ALLOC_PKT_NOT_REGD;\r
+ goto errorExit;\r
+ }\r
+ else if (!transportCfg->transportCallouts.rmSendPkt) {\r
+ *result = RM_ERROR_TRANSPORT_SEND_NOT_REGD;\r
+ goto errorExit;\r
+ }\r
\r
- transport = transportAdd(transportCfg);\r
- if ((transport->remoteInstType == Rm_instType_CLIENT_DELEGATE) ||\r
- (transport->remoteInstType == Rm_instType_SERVER)) {\r
- rmInst->registeredWithDelegateOrServer = RM_TRUE;\r
+ transport = transportAdd(transportCfg);\r
+ if ((transport->remoteInstType == Rm_instType_CLIENT_DELEGATE) ||\r
+ (transport->remoteInstType == Rm_instType_SERVER)) {\r
+ rmInst->registeredWithDelegateOrServer = RM_TRUE;\r
+ }\r
}\r
errorExit:\r
RM_SS_INST_WB_EXIT_CS(key); \r