!62 去除调试打印和增加判空

Merge pull request !62 from SimonLi/master
This commit is contained in:
openharmony_ci
2022-03-02 06:25:53 +00:00
committed by Gitee
2 changed files with 1 additions and 9 deletions
-7
View File
@@ -113,26 +113,20 @@ int SAMGR_AddRouter(Endpoint *endpoint, const SaName *saName, const Identity *id
if (endpoint == NULL || id == NULL || proxy == NULL || saName == NULL) {
return EC_INVALID;
}
printf("%s %d %d\n", __FUNCTION__ , __LINE__, pthread_self());
//todo: handle version
IServerProxy *serverProxy = NULL;
proxy->QueryInterface(proxy, SERVER_PROXY_VER, (void *)&serverProxy);
if (serverProxy == NULL) {
}
printf("%s %d %d\n", __FUNCTION__ , __LINE__, pthread_self());
// Lock the multi-write
int index = VECTOR_FindByKey(&endpoint->routers, proxy);
if (index != INVALID_INDEX) {
serverProxy->Release((IUnknown *)serverProxy);
}
printf("%s %d %d\n", __FUNCTION__ , __LINE__, pthread_self());
Router *router = SAMGR_Malloc(sizeof(Router));
if (router == NULL) {
HILOG_ERROR(HILOG_MODULE_SAMGR, "Memory is not enough! Identity<%d, %d>",
id->serviceId, id->featureId);
return EC_NOMEMORY;
}
printf("%s %d %d\n", __FUNCTION__ , __LINE__, pthread_self());
router->saName = *saName;
router->identity = *id;
router->proxy = serverProxy;
@@ -143,7 +137,6 @@ int SAMGR_AddRouter(Endpoint *endpoint, const SaName *saName, const Identity *id
SAMGR_Free(router);
return EC_FAILURE;
}
printf("%s %d %d\n", __FUNCTION__ , __LINE__, pthread_self());
Listen(endpoint, index, saName->service, saName->feature);
return index;
}
+1 -2
View File
@@ -94,7 +94,7 @@ SaNode *GetSaNodeBySaName(const char *service, const char *feature)
{
if (strncmp(node->saName.service, service, MAX_NAME_LEN) == 0) {
if (feature != NULL) {
if (strncmp(node->saName.feature, feature, MAX_NAME_LEN) == 0) {
if ((node->saName.feature != NULL) && (strncmp(node->saName.feature, feature, MAX_NAME_LEN) == 0)) {
retNode = node;
}
} else {
@@ -173,7 +173,6 @@ static void InitializeGSaList()
static void InitializeRegistry(void)
{
printf("%s %d\n", __FUNCTION__ , __LINE__);
InitializeGSaList();
g_server.mtx = MUTEX_InitValue();
SASTORA_Init(&g_server.store);