Lines Matching refs:ctxPoint
319 bool HdcForwardBase::DetechForwardType(HCtxForward ctxPoint) in DetechForwardType() argument
321 string &sFType = ctxPoint->localArgs[0]; in DetechForwardType()
322 string &sNodeCfg = ctxPoint->localArgs[1]; in DetechForwardType()
325 ctxPoint->type = FORWARD_TCP; in DetechForwardType()
327 ctxPoint->type = FORWARD_DEVICE; in DetechForwardType()
332 ctxPoint->type = FORWARD_ABSTRACT; in DetechForwardType()
335 ctxPoint->type = FORWARD_RESERVED; in DetechForwardType()
338 ctxPoint->type = FORWARD_FILESYSTEM; in DetechForwardType()
340 ctxPoint->type = FORWARD_JDWP; in DetechForwardType()
347 bool HdcForwardBase::SetupTCPPoint(HCtxForward ctxPoint) in SetupTCPPoint() argument
349 string &sNodeCfg = ctxPoint->localArgs[1]; in SetupTCPPoint()
351 ctxPoint->tcp.data = ctxPoint; in SetupTCPPoint()
352 uv_tcp_init(loopTask, &ctxPoint->tcp); in SetupTCPPoint()
354 if (ctxPoint->masterSlave) { in SetupTCPPoint()
356 uv_tcp_bind(&ctxPoint->tcp, (const struct sockaddr *)&addr, 0); in SetupTCPPoint()
357 if (uv_listen((uv_stream_t *)&ctxPoint->tcp, 4, ListenCallback)) { in SetupTCPPoint()
358 ctxPoint->lastError = "TCP Port listen failed at " + sNodeCfg; in SetupTCPPoint()
368 conn->data = ctxPoint; in SetupTCPPoint()
369 … uv_tcp_connect(conn, (uv_tcp_t *)&ctxPoint->tcp, (const struct sockaddr *)&addr, ConnectTarget); in SetupTCPPoint()
374 bool HdcForwardBase::SetupDevicePoint(HCtxForward ctxPoint) in SetupDevicePoint() argument
377 string &sNodeCfg = ctxPoint->localArgs[1]; in SetupDevicePoint()
379 if ((ctxPoint->fd = open(resolvedPath.c_str(), O_RDWR)) < 0) { in SetupDevicePoint()
380 ctxPoint->lastError = "Open unix-dev failed"; in SetupDevicePoint()
393 …ctxPoint->fdClass = new(std::nothrow) HdcFileDescriptor(loopTask, ctxPoint->fd, ctxPoint, funcRead… in SetupDevicePoint()
394 if (ctxPoint->fdClass == nullptr) { in SetupDevicePoint()
398 SetupPointContinue(ctxPoint, flag); in SetupDevicePoint()
437 bool HdcForwardBase::SetupFilePoint(HCtxForward ctxPoint) in SetupFilePoint() argument
439 string &sNodeCfg = ctxPoint->localArgs[1]; in SetupFilePoint()
440 ctxPoint->pipe.data = ctxPoint; in SetupFilePoint()
441 uv_pipe_init(loopTask, &ctxPoint->pipe, 0); in SetupFilePoint()
442 if (ctxPoint->masterSlave) { in SetupFilePoint()
443 if (ctxPoint->type == FORWARD_RESERVED || ctxPoint->type == FORWARD_FILESYSTEM) { in SetupFilePoint()
446 if (uv_pipe_bind(&ctxPoint->pipe, sNodeCfg.c_str())) { in SetupFilePoint()
447 ctxPoint->lastError = "Unix pipe bind failed"; in SetupFilePoint()
450 if (uv_listen((uv_stream_t *)&ctxPoint->pipe, 4, ListenCallback)) { in SetupFilePoint()
451 ctxPoint->lastError = "Unix pipe listen failed"; in SetupFilePoint()
455 if (ctxPoint->type == FORWARD_ABSTRACT) { in SetupFilePoint()
456 bool abstractRet = LocalAbstractConnect(&ctxPoint->pipe, sNodeCfg); in SetupFilePoint()
457 SetupPointContinue(ctxPoint, abstractRet ? 0 : -1); in SetupFilePoint()
459 ctxPoint->lastError = "LocalAbstractConnect failed"; in SetupFilePoint()
468 connect->data = ctxPoint; in SetupFilePoint()
469 uv_pipe_connect(connect, &ctxPoint->pipe, sNodeCfg.c_str(), ConnectTarget); in SetupFilePoint()
475 bool HdcForwardBase::SetupPoint(HCtxForward ctxPoint) in SetupPoint() argument
478 if (!DetechForwardType(ctxPoint)) { in SetupPoint()
481 switch (ctxPoint->type) { in SetupPoint()
483 if (!SetupTCPPoint(ctxPoint)) { in SetupPoint()
489 if (!SetupDevicePoint(ctxPoint)) { in SetupPoint()
494 if (!SetupJdwpPoint(ctxPoint)) { in SetupPoint()
501 if (!SetupFilePoint(ctxPoint)) { in SetupPoint()
511 ctxPoint->lastError = "Not supoort forward-type"; in SetupPoint()
516 ctxPoint->lastError = "Not supoort forward-type"; in SetupPoint()
528 HCtxForward ctxPoint = (HCtxForward)MallocContext(true); in BeginForward() local
529 if (!ctxPoint) { in BeginForward()
545 if (!CheckNodeInfo(argv[0], ctxPoint->localArgs)) { in BeginForward()
548 if (!CheckNodeInfo(argv[1], ctxPoint->remoteArgs)) { in BeginForward()
551 ctxPoint->remoteParamenters = argv[1]; in BeginForward()
552 if (!SetupPoint(ctxPoint)) { in BeginForward()
559 sError = ctxPoint->lastError; in BeginForward()
564 SendToTask(ctxPoint->id, CMD_FORWARD_CHECK, reinterpret_cast<uint8_t *>(bufString), in BeginForward()
585 HCtxForward ctxPoint = (HCtxForward)MallocContext(false); in SlaveConnect() local
586 if (!ctxPoint) { in SlaveConnect()
590 idSlaveOld = ctxPoint->id; in SlaveConnect()
591 ctxPoint->checkPoint = bCheckPoint; in SlaveConnect()
593 FilterCommand(bufCmd, &ctxPoint->id, reinterpret_cast<uint8_t **>(&content)); in SlaveConnect()
594 AdminContext(OP_UPDATE, idSlaveOld, ctxPoint); in SlaveConnect()
596 if (!CheckNodeInfo(content, ctxPoint->localArgs)) { in SlaveConnect()
599 if ((ctxPoint->checkPoint && slaveCheckWhenBegin) || !ctxPoint->checkPoint) { in SlaveConnect()
600 if (!SetupPoint(ctxPoint)) { in SlaveConnect()
604 sError = ctxPoint->lastError; in SlaveConnect()
606 SetupPointContinue(ctxPoint, 0); in SlaveConnect()
611 FreeContext(ctxPoint, 0, true); in SlaveConnect()