Lines Matching defs:connection

66 static void ProcessRecvMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message);
214 if (ctx == NULL || ctx->message == NULL || ctx->message->connection != data) {
229 AppSpawnConnection *connection = (AppSpawnConnection *)LE_GetUserData(taskHandle);
230 APPSPAWN_CHECK(connection != NULL, return, "Invalid connection");
231 if (connection->receiverCtx.timer) {
232 LE_StopTimer(LE_GetDefaultLoop(), connection->receiverCtx.timer);
233 connection->receiverCtx.timer = NULL;
236 connection->connectionId, LE_GetSocketFd(taskHandle));
237 DeleteAppSpawnMsg(connection->receiverCtx.incompleteMsg);
238 connection->receiverCtx.incompleteMsg = NULL;
240 AppSpawningCtxTraversal(AppSpawningCtxOnClose, connection);
245 AppSpawnConnection *connection = (AppSpawnConnection *)LE_GetUserData(taskHandle);
246 APPSPAWN_CHECK(connection != NULL, return, "Invalid connection");
248 connection->connectionId, LE_GetSocketFd(taskHandle));
254 AppSpawnConnection *connection = (AppSpawnConnection *)LE_GetUserData(taskHandle);
255 APPSPAWN_CHECK(connection != NULL, return, "Invalid connection");
266 connection->connectionId, LE_GetSendResult(handle), appInfo->name, msg->result.pid);
272 static int SendResponse(const AppSpawnConnection *connection, const AppSpawnMsg *msg, int result, pid_t pid)
275 connection->connectionId, result, pid);
284 return LE_Send(LE_GetDefaultLoop(), connection->stream, handle, bufferSize);
289 AppSpawnConnection *connection = (AppSpawnConnection *)context;
290 APPSPAWN_LOGE("Long time no msg complete so close connectionId: %{public}u", connection->connectionId);
291 DeleteAppSpawnMsg(connection->receiverCtx.incompleteMsg);
292 connection->receiverCtx.incompleteMsg = NULL;
293 LE_CloseStreamTask(LE_GetDefaultLoop(), connection->stream);
296 static inline int StartTimerForCheckMsg(AppSpawnConnection *connection)
298 if (connection->receiverCtx.timer != NULL) {
301 int ret = LE_CreateTimer(LE_GetDefaultLoop(), &connection->receiverCtx.timer, WaitMsgCompleteTimeOut, connection);
303 ret = LE_StartTimer(LE_GetDefaultLoop(), connection->receiverCtx.timer, MAX_WAIT_MSG_COMPLETE, 1);
323 AppSpawnConnection *connection = (AppSpawnConnection *) LE_GetUserData(taskHandle);
324 APPSPAWN_CHECK(connection != NULL, return -1, "Invalid connection");
334 "failed to recv fd %{public}d %{public}d", connection->receiverCtx.fdCount, fdCount);
335 int ret = memcpy_s(connection->receiverCtx.fds,
338 connection->receiverCtx.fdCount = fdCount;
383 AppSpawnConnection *connection = (AppSpawnConnection *)LE_GetUserData(stream);
384 APPSPAWN_CHECK(connection != NULL, return -1, "Failed to alloc stream");
395 connection->connectionId = ++connectionId;
396 connection->stream = stream;
397 connection->receiverCtx.fdCount = 0;
398 connection->receiverCtx.incompleteMsg = NULL;
399 connection->receiverCtx.timer = NULL;
400 connection->receiverCtx.msgRecvLen = 0;
401 connection->receiverCtx.nextMsgId = 1;
403 connection->connectionId, LE_GetSocketFd(stream));
430 AppSpawnConnection *connection = (AppSpawnConnection *)LE_GetUserData(taskHandle);
431 APPSPAWN_CHECK(connection != NULL, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
438 AppSpawnMsgNode *message = connection->receiverCtx.incompleteMsg; // incomplete msg
439 connection->receiverCtx.incompleteMsg = NULL;
443 connection->connectionId, *(uint32_t *)(buffer + currLen), buffLen - currLen);
446 &message, &connection->receiverCtx.msgRecvLen, &reminder);
449 if (connection->receiverCtx.msgRecvLen != message->msgHeader.msgLen) { // recv complete msg
450 connection->receiverCtx.incompleteMsg = message;
454 connection->receiverCtx.msgRecvLen = 0;
455 if (connection->receiverCtx.timer) {
456 LE_StopTimer(LE_GetDefaultLoop(), connection->receiverCtx.timer);
457 connection->receiverCtx.timer = NULL;
460 APPSPAWN_CHECK_ONLY_EXPER(MsgDevicedebugCheck(connection->stream, message),
466 (void)ProcessRecvMsg(connection, message);
478 if (connection->receiverCtx.incompleteMsg != NULL) { // Start the detection timer
479 ret = StartTimerForCheckMsg(connection);
481 return, "Failed to create time for connection");
884 static void ProcessSpawnReqMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
888 SendResponse(connection, &message->msgHeader, ret, 0);
903 SendResponse(connection, &message->msgHeader, APPSPAWN_SYSTEM_ERROR, 0);
910 message->connection = connection;
920 SendResponse(connection, &message->msgHeader, ret, 0);
926 SendResponse(connection, &message->msgHeader, ret, 0);
948 SendResponse(property->message->connection, &property->message->msgHeader, APPSPAWN_CHILD_CRASH, 0);
969 SendResponse(property->message->connection, &property->message->msgHeader, APPSPAWN_SPAWN_TIMEOUT, 0);
982 SendResponse(property->message->connection, &property->message->msgHeader, result, property->pid);
1035 SendResponse(property->message->connection, &property->message->msgHeader, result, property->pid);
1348 static AppSpawnMsgNode *ProcessSpawnBegetctlMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
1365 static void ProcessBegetCmdMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
1369 SendResponse(connection, msg, APPSPAWN_DEBUG_MODE_NOT_SUPPORT, 0);
1373 AppSpawnMsgNode *msgNode = ProcessSpawnBegetctlMsg(connection, message);
1375 SendResponse(connection, msg, APPSPAWN_DEBUG_MODE_NOT_SUPPORT, 0);
1379 ProcessSpawnReqMsg(connection, msgNode);
1409 static int ProcessSpawnRemountMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
1453 static int ProcessSpawnRemountMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
1509 static void ProcessSpawnRestartMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
1513 SendResponse(connection, &message->msgHeader, APPSPAWN_MSG_INVALID, 0);
1520 SendResponse(connection, &message->msgHeader, 0, 0);
1620 static void ProcessRecvMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message)
1625 APPSPAWN_CHECK_ONLY_LOG(connection->receiverCtx.nextMsgId == msg->msgId,
1626 "Invalid msg id %{public}u %{public}u", connection->receiverCtx.nextMsgId, msg->msgId);
1627 connection->receiverCtx.nextMsgId++;
1634 SendResponse(connection, msg, ret == 0 ? result.result : ret, result.pid);
1640 ProcessSpawnReqMsg(connection, message);
1645 SendResponse(connection, msg, 0, 0);
1649 ProcessBegetCmdMsg(connection, message);
1653 SendResponse(connection, msg, GetAppSpawnMgr()->spawnTime.minAppspawnTime,
1658 ret = ProcessSpawnRemountMsg(connection, message);
1659 SendResponse(connection, msg, ret, 0);
1662 ProcessSpawnRestartMsg(connection, message);
1666 SendResponse(connection, msg, ret, 0);
1670 SendResponse(connection, msg, APPSPAWN_MSG_INVALID, 0);