Lines Matching refs:ctxPoint
322 bool HdcForwardBase::DetechForwardType(HCtxForward ctxPoint) in DetechForwardType() argument
324 string &sFType = ctxPoint->localArgs[0]; in DetechForwardType()
325 string &sNodeCfg = ctxPoint->localArgs[1]; in DetechForwardType()
328 ctxPoint->type = FORWARD_TCP; in DetechForwardType()
330 ctxPoint->type = FORWARD_DEVICE; in DetechForwardType()
335 ctxPoint->type = FORWARD_ABSTRACT; in DetechForwardType()
338 ctxPoint->type = FORWARD_RESERVED; in DetechForwardType()
341 ctxPoint->type = FORWARD_FILESYSTEM; in DetechForwardType()
343 ctxPoint->type = FORWARD_JDWP; in DetechForwardType()
350 bool HdcForwardBase::SetupTCPPoint(HCtxForward ctxPoint) in SetupTCPPoint() argument
352 string &sNodeCfg = ctxPoint->localArgs[1]; in SetupTCPPoint()
354 ctxPoint->tcp.data = ctxPoint; in SetupTCPPoint()
355 uv_tcp_init(loopTask, &ctxPoint->tcp); in SetupTCPPoint()
357 if (ctxPoint->masterSlave) { in SetupTCPPoint()
359 uv_tcp_bind(&ctxPoint->tcp, (const struct sockaddr *)&addr, 0); in SetupTCPPoint()
360 if (uv_listen((uv_stream_t *)&ctxPoint->tcp, 4, ListenCallback)) { in SetupTCPPoint()
361 ctxPoint->lastError = "TCP Port listen failed at " + sNodeCfg; in SetupTCPPoint()
371 conn->data = ctxPoint; in SetupTCPPoint()
372 … uv_tcp_connect(conn, (uv_tcp_t *)&ctxPoint->tcp, (const struct sockaddr *)&addr, ConnectTarget); in SetupTCPPoint()
377 bool HdcForwardBase::SetupDevicePoint(HCtxForward ctxPoint) in SetupDevicePoint() argument
380 string &sNodeCfg = ctxPoint->localArgs[1]; in SetupDevicePoint()
382 if ((ctxPoint->fd = open(resolvedPath.c_str(), O_RDWR)) < 0) { in SetupDevicePoint()
383 ctxPoint->lastError = "Open unix-dev failed"; in SetupDevicePoint()
396 …ctxPoint->fdClass = new(std::nothrow) HdcFileDescriptor(loopTask, ctxPoint->fd, ctxPoint, funcRead… in SetupDevicePoint()
397 if (ctxPoint->fdClass == nullptr) { in SetupDevicePoint()
401 SetupPointContinue(ctxPoint, flag); in SetupDevicePoint()
440 bool HdcForwardBase::SetupFilePoint(HCtxForward ctxPoint) in SetupFilePoint() argument
442 string &sNodeCfg = ctxPoint->localArgs[1]; in SetupFilePoint()
443 ctxPoint->pipe.data = ctxPoint; in SetupFilePoint()
444 uv_pipe_init(loopTask, &ctxPoint->pipe, 0); in SetupFilePoint()
445 if (ctxPoint->masterSlave) { in SetupFilePoint()
446 if (ctxPoint->type == FORWARD_RESERVED || ctxPoint->type == FORWARD_FILESYSTEM) { in SetupFilePoint()
449 if (uv_pipe_bind(&ctxPoint->pipe, sNodeCfg.c_str())) { in SetupFilePoint()
450 ctxPoint->lastError = "Unix pipe bind failed"; in SetupFilePoint()
453 if (uv_listen((uv_stream_t *)&ctxPoint->pipe, 4, ListenCallback)) { in SetupFilePoint()
454 ctxPoint->lastError = "Unix pipe listen failed"; in SetupFilePoint()
458 if (ctxPoint->type == FORWARD_ABSTRACT) { in SetupFilePoint()
459 bool abstractRet = LocalAbstractConnect(&ctxPoint->pipe, sNodeCfg); in SetupFilePoint()
460 SetupPointContinue(ctxPoint, abstractRet ? 0 : -1); in SetupFilePoint()
462 ctxPoint->lastError = "LocalAbstractConnect failed"; in SetupFilePoint()
471 connect->data = ctxPoint; in SetupFilePoint()
472 uv_pipe_connect(connect, &ctxPoint->pipe, sNodeCfg.c_str(), ConnectTarget); in SetupFilePoint()
478 bool HdcForwardBase::SetupPoint(HCtxForward ctxPoint) in SetupPoint() argument
481 if (!DetechForwardType(ctxPoint)) { in SetupPoint()
484 switch (ctxPoint->type) { in SetupPoint()
486 if (!SetupTCPPoint(ctxPoint)) { in SetupPoint()
492 if (!SetupDevicePoint(ctxPoint)) { in SetupPoint()
497 if (!SetupJdwpPoint(ctxPoint)) { in SetupPoint()
504 if (!SetupFilePoint(ctxPoint)) { in SetupPoint()
514 ctxPoint->lastError = "Not supoort forward-type"; in SetupPoint()
519 ctxPoint->lastError = "Not supoort forward-type"; in SetupPoint()
531 HCtxForward ctxPoint = (HCtxForward)MallocContext(true); in BeginForward() local
532 if (!ctxPoint) { in BeginForward()
548 if (!CheckNodeInfo(argv[0], ctxPoint->localArgs)) { in BeginForward()
551 if (!CheckNodeInfo(argv[1], ctxPoint->remoteArgs)) { in BeginForward()
554 ctxPoint->remoteParamenters = argv[1]; in BeginForward()
555 if (!SetupPoint(ctxPoint)) { in BeginForward()
562 sError = ctxPoint->lastError; in BeginForward()
567 SendToTask(ctxPoint->id, CMD_FORWARD_CHECK, reinterpret_cast<uint8_t *>(bufString), in BeginForward()
588 HCtxForward ctxPoint = (HCtxForward)MallocContext(false); in SlaveConnect() local
589 if (!ctxPoint) { in SlaveConnect()
593 idSlaveOld = ctxPoint->id; in SlaveConnect()
594 ctxPoint->checkPoint = bCheckPoint; in SlaveConnect()
596 FilterCommand(bufCmd, &ctxPoint->id, reinterpret_cast<uint8_t **>(&content)); in SlaveConnect()
597 AdminContext(OP_UPDATE, idSlaveOld, ctxPoint); in SlaveConnect()
599 if (!CheckNodeInfo(content, ctxPoint->localArgs)) { in SlaveConnect()
602 if ((ctxPoint->checkPoint && slaveCheckWhenBegin) || !ctxPoint->checkPoint) { in SlaveConnect()
603 if (!SetupPoint(ctxPoint)) { in SlaveConnect()
607 sError = ctxPoint->lastError; in SlaveConnect()
609 SetupPointContinue(ctxPoint, 0); in SlaveConnect()
614 FreeContext(ctxPoint, 0, true); in SlaveConnect()