update samgr_endpoint/source/endpoint.c.

This commit is contained in:
zjucx 2020-12-01 15:59:30 +08:00 committed by Gitee
parent 9d13ef34e3
commit a529b13d80
1 changed files with 7 additions and 4 deletions

View File

@ -427,15 +427,18 @@ static int OnSamgrServerExit(const IpcContext *context, void *ipcMsg, IpcIo *dat
router->policyNum = 0;
}
SvcIdentity old = endpoint->identity;
while (endpoint->registerEP(endpoint->context, &endpoint->identity) != EC_SUCCESS) {
HILOG_ERROR(HILOG_MODULE_SAMGR, "Reconnect to samgr server failed!");
sleep(RETRY_INTERVAL);
}
SvcIdentity new = endpoint->identity;
if (old.handle != new.handle || old.cookie != new.cookie || old.token != new.token) {
HILOG_ERROR(HILOG_MODULE_SAMGR, "Samgr server identity error!");
exit(-1);
}
SvcIdentity identity;
identity.handle = SAMGR_HANDLE;
identity.token = SAMGR_TOKEN;
identity.cookie = SAMGR_COOKIE;
SvcIdentity identity = {SAMGR_HANDLE, SAMGR_TOKEN, SAMGR_COOKIE};
(void)UnregisterDeathCallback(identity, endpoint->deadId);
(void)RegisterDeathCallback(endpoint->context, identity, OnSamgrServerExit, endpoint, &endpoint->deadId);
int remain = RegisterRemoteFeatures(endpoint);