Lines Matching refs:ctxPoint
339 bool HdcForwardBase::DetechForwardType(HCtxForward ctxPoint)
341 string &sFType = ctxPoint->localArgs[0];
342 string &sNodeCfg = ctxPoint->localArgs[1];
345 ctxPoint->type = FORWARD_TCP;
347 ctxPoint->type = FORWARD_DEVICE;
352 ctxPoint->type = FORWARD_ABSTRACT;
355 ctxPoint->type = FORWARD_RESERVED;
358 ctxPoint->type = FORWARD_FILESYSTEM;
360 ctxPoint->type = FORWARD_JDWP;
362 ctxPoint->type = FORWARD_ARK;
369 bool HdcForwardBase::SetupTCPPoint(HCtxForward ctxPoint)
371 string &sNodeCfg = ctxPoint->localArgs[1];
373 ctxPoint->tcp.data = ctxPoint;
374 uv_tcp_init(loopTask, &ctxPoint->tcp);
376 if (ctxPoint->masterSlave) {
378 uv_tcp_bind(&ctxPoint->tcp, (const struct sockaddr *)&addr, 0);
379 if (uv_listen((uv_stream_t *)&ctxPoint->tcp, UV_LISTEN_LBACKOG, ListenCallback)) {
380 ctxPoint->lastError = "TCP Port listen failed at " + sNodeCfg;
390 conn->data = ctxPoint;
391 uv_tcp_connect(conn, (uv_tcp_t *)&ctxPoint->tcp, (const struct sockaddr *)&addr, ConnectTarget);
396 bool HdcForwardBase::SetupDevicePoint(HCtxForward ctxPoint)
399 string &sNodeCfg = ctxPoint->localArgs[1];
401 if ((ctxPoint->fd = open(resolvedPath.c_str(), O_RDWR)) < 0) {
402 ctxPoint->lastError = "Open unix-dev failed";
415 ctxPoint->fdClass = new(std::nothrow) HdcFileDescriptor(loopTask, ctxPoint->fd, ctxPoint, funcRead,
417 if (ctxPoint->fdClass == nullptr) {
418 WRITE_LOG(LOG_FATAL, "SetupDevicePoint new ctxPoint->fdClass failed");
421 SetupPointContinue(ctxPoint, flag);
462 bool HdcForwardBase::SetupFilePoint(HCtxForward ctxPoint)
464 string &sNodeCfg = ctxPoint->localArgs[1];
465 ctxPoint->pipe.data = ctxPoint;
466 uv_pipe_init(loopTask, &ctxPoint->pipe, 0);
467 if (ctxPoint->masterSlave) {
468 if (ctxPoint->type == FORWARD_RESERVED || ctxPoint->type == FORWARD_FILESYSTEM) {
471 if (uv_pipe_bind(&ctxPoint->pipe, sNodeCfg.c_str())) {
472 ctxPoint->lastError = "Unix pipe bind failed";
475 if (uv_listen((uv_stream_t *)&ctxPoint->pipe, UV_LISTEN_LBACKOG, ListenCallback)) {
476 ctxPoint->lastError = "Unix pipe listen failed";
480 if (ctxPoint->type == FORWARD_ABSTRACT) {
481 bool abstractRet = LocalAbstractConnect(&ctxPoint->pipe, sNodeCfg);
482 SetupPointContinue(ctxPoint, abstractRet ? 0 : -1);
484 ctxPoint->lastError = "LocalAbstractConnect failed";
493 connect->data = ctxPoint;
494 uv_pipe_connect(connect, &ctxPoint->pipe, sNodeCfg.c_str(), ConnectTarget);
500 bool HdcForwardBase::SetupPoint(HCtxForward ctxPoint)
503 if (!DetechForwardType(ctxPoint)) {
506 switch (ctxPoint->type) {
508 if (!SetupTCPPoint(ctxPoint)) {
514 if (!SetupDevicePoint(ctxPoint)) {
519 if (!SetupJdwpPoint(ctxPoint)) {
526 if (!SetupFilePoint(ctxPoint)) {
536 ctxPoint->lastError = "Not supoort forward-type";
541 ctxPoint->lastError = "Not supoort forward-type";
553 HCtxForward ctxPoint = (HCtxForward)MallocContext(true);
554 if (!ctxPoint) {
570 if (!CheckNodeInfo(argv[0], ctxPoint->localArgs)) {
573 if (!CheckNodeInfo(argv[1], ctxPoint->remoteArgs)) {
576 ctxPoint->remoteParamenters = argv[1];
577 if (!SetupPoint(ctxPoint)) {
584 sError = ctxPoint->lastError;
589 SendToTask(ctxPoint->id, CMD_FORWARD_CHECK, reinterpret_cast<uint8_t *>(bufString),
614 HCtxForward ctxPoint = (HCtxForward)MallocContext(false);
615 if (!ctxPoint) {
619 idSlaveOld = ctxPoint->id;
620 ctxPoint->checkPoint = bCheckPoint;
622 FilterCommand(bufCmd, &ctxPoint->id, reinterpret_cast<uint8_t **>(&content));
623 AdminContext(OP_UPDATE, idSlaveOld, ctxPoint);
625 if (!CheckNodeInfo(content, ctxPoint->localArgs)) {
629 if (!DetechForwardType(ctxPoint)) {
633 WRITE_LOG(LOG_DEBUG, "id:%u type:%d", ctxPoint->id, ctxPoint->type);
634 if (ctxPoint->type == FORWARD_ARK) {
635 if (ctxPoint->checkPoint) {
636 if (!SetupArkPoint(ctxPoint)) {
637 sError = ctxPoint->lastError;
642 SetupPointContinue(ctxPoint, 0);
646 if (!ctxPoint->checkPoint) {
647 if (!SetupPoint(ctxPoint)) {
648 sError = ctxPoint->lastError;
653 SetupPointContinue(ctxPoint, 0);
659 FreeContext(ctxPoint, 0, true);